← Quiz: Python Strings: all 15 questions
Quiz: Python Strings · Question 10 of 15
Why does s[0] = "J" fail for a string s?
Why does s[0] = "J" fail for a string s?
- A.Index 0 doesn't exist
- B.Strings are immutable
- C.J is not a valid character
- D.Strings need double quotes
Answer & explanation
Correct answer: Strings are immutable
Build a new string instead: "J" + s[1:].
Can you get the rest right without peeking?
Take the timed Quiz: Python Strings quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →