Explanation:
๐น 1. Variable Assignment
clcoding = "hello"
✅ Explanation:
A variable clcoding is created.
It stores the string "hello".
๐ Current value:
clcoding = "hello"
๐น 2. Attempt to Modify First Character
clcoding[0] = "H"
❗ Explanation:
clcoding[0] refers to the first character ("h").
You are trying to change "h" → "H".
๐น 3. Error Occurs
TypeError: ❌
Reason:
Strings in Python are immutable (cannot be changed).
So, direct modification is not allowed.'str' object does not support item assignment

0 Comments:
Post a Comment