Python Learning Series · @onlysamarrr · Day 6 / 30
Day 6 covers string methods like strip(), upper(), title(), split() and replace(). Strings are immutable, so every method returns a new string instead of changing the original.
Phase: Beginner · Reels: 26/450 – 30/450
Day 6 covers string methods like strip(), upper(), title(), split() and replace(). Strings are immutable, so every method returns a new string instead of changing the original.
s = " arhan KHAN "
print(s.strip())
print(s.strip().title())
print(s.upper().strip())
print("a,b,c".split(","))
print("-".join(["a", "b"]))
print("tea".replace("t", "T"))
print(" Arhan_Dev ".strip().lower())
arhan KHAN Arhan Khan ARHAN KHAN ['a', 'b', 'c'] a-b Tea arhan_dev
Cleaning usernames, emails and form input uses strip(), lower() and title() in almost every app.
Select (tick) an option, then tap Check answer to see instantly whether your answer is right or wrong, with an explanation. You can change your answer and check again.
Q1. What does " hi ".strip() return?
Q2. After s = "hi" and s.upper(), what is s?
Q3. What does "a,b".split(",") return?
| 26/450 | Concept | upper, lower, title |
| 27/450 | Live demo | strip, replace, split demo |
| 28/450 | Common mistake | Strings immutable hain |
| 29/450 | Quiz | Quiz: naam ko capitalize karo |
| 30/450 | Interview / real life | Real life: username cleaner |