🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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?

  1. A.Index 0 doesn't exist
  2. B.Strings are immutable
  3. C.J is not a valid character
  4. 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 →