Complete the following:
- Assign your first name to a variable named fullName
- Append (or add) a space and your last name to fullName
- Print out each of the characters in fullName with a loop
Answer the following questions then confirm with your neighbor:
- What is the index of the first letter of your first name in fullName?
- What is the index of the first letter of your last name in fullName?
- How can we determine the length of any str variable in python?
- What will be the result of the following python code?
fullName[0] = 'Z'
- What does the following python script print out (if anything)?
word = "stressed"
startIndex = -1
lastIndex = 0 - len(word)
step = -1
for charIndex in range( startIndex, lastIndex + step, step):
print( word[ charIndex], end='')
print()
- What will be the result of each of the following statements?
- print( fullName[ 3:5 ])
- print( fullName[ :5 ])
- print( fullName[ 3: ])
- print( fullName[ : ])
- print( fullName[ -3: ])
- print( fullName[-50: ])
- print( fullName[ :-2 ])
- print( fullName[ 3:50 ])
- print( fullName[ 3:10:2])
- print( fullName[ 3:10:3])