What is a string?
A conglomeration of characters.
What is a for loop?
The way to repeat the code a known number of times.
What is slicing?
Slicing is the division of a string.
What does len stand for?
Length.
True or false?
Code does not have to be indented to operate within the for loop.
FALSE
Code must be indented to operate within the for loop.
What code is used to slice?
print(word[#:#])
In the word APCSP, which letter is considered index 3?
Index 3 is S.
range(#) generates the list of numbers.
If the word is "trivia", what code is needed to slice trivia into tri? (include the index numbers in your answer)
print(word[0:4])
Which code allows for the word length to appear on the screen?
print(wordLength)
THROWBACK QUESTION:
What command is used to debug?
Print.
If the word is "trivia", what would the following code slicing produce?
print(word[3:])
via
What code always picks the last letter?
print(word[len(word)-1])
In the following code, which is a fluctuating variable?
for i in range(#)
i is the fluctuating variable.
To add a dash to the letter v in "trivia", what code is needed? (include the index numbers)
product: tri-ia
word = word[:3] + "-" + word[4:]