Yellow Hat – Strings & Dictionaries
beginner15 XP
String Mastery
Learn powerful string methods to manipulate and format text
String Mastery
Python
message = "hello, world!"
print(message.upper()) # HELLO, WORLD!
print(message.capitalize()) # Hello, world!
print(len(message)) # 13f-strings
Python
name = "Alex"
score = 95
print(f"Well done {name}! You scored {score}/100.")Split & Join
Python
sentence = "I love coding"
words = sentence.split(" ") # ["I", "love", "coding"]
joined = "-".join(words) # "I-love-coding"⌨️
Type it yourself
Don't just read it — type the example from above into the box, press Run ▶, and watch what happens. Typing it yourself is how it really sticks! Stuck? Tap Show example.
Python · Playground
Output
Press ▶ Run to see your code come to life…Quick check
01/2
What does "python".upper() return?