Invent a game character! Make variables for hero_name (string), level (int), health (float), and has_sword (bool). Print them all. Then make your hero level up by changing level.
🏋️ Extra Practice — Drill Time!
Variables click only after you have made dozens of them. Do every task below — write the code yourself, run it, then check it.
🔁
Task 5: The Great Swap
Medium
Make left = "apple" and right = "banana", then swap what is inside the two boxes so that printing left then right shows banana then apple. Hint: a third helper box, or Python's magic a, b = b, a.
banana
apple
left = "apple"
right = "banana"
left, right = right, left
print(left)
print(right)
⚡
Task 6: Shortcut Math
Easy
score += 10 is a shortcut for score = score + 10. Start with score = 0, add 10, add 25, then take away 5 — using the shortcuts += and -= — and print the final score.
Python can fill two boxes in one line: x, y = 3, 8. Do that, then print their sum, then print their product.
11
24
x, y = 3, 8
print(x + y)
print(x * y)
🔤
Task 8: Numbers Into Words
Medium
You cannot add text to a number directly. Make age = 11, then print I am 11 years old by turning the number into text with str(age) and joining with +.
I am 11 years old
age = 11
print("I am " + str(age) + " years old")
🔢
Task 9: Words Into Numbers
Medium
Sometimes a number arrives as text. Make text_number = "42", turn it into a real number with int(), store it in real_number, then print real_number + 8 and type(real_number).
Make variables apples = 4, apple_price = 0.5, breads = 2, bread_price = 1.25. Print the apple total, the bread total, then the grand total — three lines.
A hero starts with level = 1, health = 100.0, coins = 0, name = "Zara". Then: the hero finds 50 coins, loses 25.5 health, and levels up twice. Print the four values afterwards, each on its own line, in the order name, level, health, coins.
Zara
3
74.5
50
name = "Zara"
level = 1
health = 100.0
coins = 0
coins += 50
health -= 25.5
level += 1
level += 1
print(name)
print(level)
print(health)
print(coins)
🏷️
Task 13: Free Play — Name Things Well
Creative
Invent five variables about yourself with really clear names (like favorite_sport, not x). Give them different types — text, whole number, decimal and True/False — then print them all with labels.