🚀 Hurry! Offer Ends In
00 Days
00 Hours
00 Mins
00 Secs
Enroll Now
X

एक स्ट्रिंग s="Welcome" दी गई है, निम्नलिखित में से कौन सा कोड गलत है?

Given a string s="Welcome", which of the following code is incorrect ?

A)
B)
C)
D)

Explanation:

Here’s a quick breakdown:

  • (A) s[0] is correct; it prints the first character "W".
  • (B) s.lower() is correct; it converts the string to "welcome".
  • (C) s[1] = 'r' is incorrect because strings are immutable in Python (you can't change individual characters).
  • (D) s.strip() is correct; it removes any leading or trailing spaces (if any).

Answer:

(C) s[1] = 'r' is incorrect.

Latest Updates