QUESTION IMAGE
Question
question # 1
multiple choice
you have previously used slicing with strings.
what is the output?
str = abcdef
print(str2:5)
o cdef
o cde
o bcd
o bcde
Step1: Understand string slicing
In Python, string slicing str[a:b] extracts characters from index a (inclusive) to index b (exclusive).
Step2: Identify indices
Here, str = 'abcdef', a = 2 and b = 5. The characters at indices 2, 3, 4 are 'c', 'd', 'e' respectively.
Snap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
B. cde