Day 3 of 30Python Foundations
✍️Strings & Text
🎯 Today's objective
Manipulate text — the raw material of language AI.
📖 Key concepts
- Strings hold text in quotes
- Concatenation with +, repeat with *
- f-strings: f"Hi {name}"
- Methods: .upper(), .lower(), .strip(), len()
💻 Try this code
name = "minu"
print(f"Hello, {name.title()}!")
print(name.upper(), "has", len(name), "letters")
print("ha" * 3)👥 Learn it your way
🧒 Young Explorers
Strings are like beads on a thread — you can join, repeat, and count them.
Your task
Ask for a word and print it in UPPERCASE, in Title Case, and its length.
💼 Professionals
f-strings are the modern formatting standard; prefer them over % and .format().
Your task
Given a messy " John SMITH " string, normalise it to "John Smith" using strip/title.
🤖 AI connection
Language models read text as strings first, then split it into "tokens". Cleaning text (lowercasing, stripping) is the first step of almost every NLP pipeline.
✅ Quick check
What does an f-string let you do?
Embed variables/expressions directly inside a string with {}.
What does len("AI") return?
2