CBSE Class 11 Computer Science
Question 16 of 19
Strings in Python — Question 16
Back to all questionsmmin
y Py
My Python Program
My Python Programming
My Python
My
str[-5:-1]extracts the substring from the 5th last character up to, but not including, the last character: "mmin".str[1:5]extracts the substring from index 1 to 4: "y Py".str[:-4]extracts the substring from the beginning up to, but not including, the last 4 characters.str[0:]extracts the substring from index 0 to the end.str[:13-4]is equivalent to str[:9], which extracts the substring from the beginning up to, but not including, index 9: "My Python".str[:3]extracts the substring from the beginning up to, but not including, index 3: "My ".