Post

PyBerry Tech 🐍🍓
PyBerry Tech 🐍🍓@PyBerryTech·
@Python_Dv Option C : Error😉 Why??👇 This gives an error because strings in Python are immutable. Immutable means you cannot change individual characters of a string after it is created. So this is not allowed: a[0] = "p" ❌
English
0
0
0
1.5K
Kamal Gurjar
Kamal Gurjar@KamalGurjar8·
@Python_Dv Output ​C) error Strings are immutable in Python so you can't change characters by index. If you want to capitalize it, you'd need to reassign it using a method: a = a.capitalize().
English
0
0
0
1.4K
EVY TECHNO
EVY TECHNO@EvyTechno·
Analysis Immutability: Strings in Python are immutable, meaning you cannot change an individual character in place after the string is created. The Operation: a[0] = "P" attempts to modify the first character of the string. Result: This will raise a TypeError: 'str' object does not support item assignment. Answer: C) error.
English
0
0
0
899
Python Tech
Python Tech@PythonTech43716·
@Python_Dv Error is right answer. String is immutable so we can't perform any changes in string, If you still want to print Python then you use method . captilize() and get the result as Python.
English
0
0
0
237
Paylaş