Question 5
Back to Exercise
The program should print the name in capitals. Which statement correctly identifies the bug?
name = "meera"
name.upper()
print("Welcome,", name)
- A upper() only works on single letters
- B print should use an f-string
- C upper() returns a new string, and its result is thrown away; write name = name.upper() Correct
- D name must be declared as str
Correct Answer: Option C
Strings are immutable; every string method returns a new value that must be stored.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!