Lesson 18 of 55 · Python
String Manipulation
Duration: 20 minutes
Lesson 18 of 55 · Python
Duration: 20 minutes
python\nmsg = 'Hello, World!'\nprint(msg.upper()) # HELLO, WORLD!\nprint(msg[7:12]) # World\n\n# f‑strings (Python 3.6+) for clean interpolation\nname = 'Alice'\nprint(f'Hi, {name}!')\n\n\nBecause strings are immutable, operations like upper() return a new string rather than modifying the original.\n