Your Magical Journey
Complete lessons to earn House Points and unlock new spells!
๐ Spell Cast Successfully!
You've mastered this magic!
๐งโโ๏ธ Free Practice Chamber
Practice any spell you've learned! This is your space to experiment and create.
๐ The Python Spellbook
A reference of all the magical spells (code) you'll learn
๐ฎ Basic Incantations
print("message")
Makes words appear magically! Like casting Illuminate to reveal text.
input("question")
Asks the wizard (user) a question and remembers their answer.
๐ฆ Magical Containers (Variables)
name = "Luna"
Stores a piece of text (called a "string") in a magical container.
age = 11
Stores a number in a container. Numbers don't need quotes!
๐งฎ Arithmancy (Maths)
+ - * /
Add, subtract, multiply, and divide numbers.
**
Powers! Like 2**3 means 2ร2ร2 = 8
๐ญ The Magic Hat (Decisions)
if condition:
Do something only IF a condition is true.
else:
Do something different if the condition was false.
elif condition:
Check another condition (short for "else if").
๐ Time-Turner (Loops)
for i in range(5):
Repeat something a certain number of times (5 times here).
for item in list:
Go through each thing in a list, one by one.
while condition:
Keep repeating while something is true.
๐ Magical Lists
creatures = ["dragon", "phoenix", "hippogriff"]
A list holds multiple items in order.
creatures[0]
Get the first item (counting starts at 0!).
creatures.append("unicorn")
Add a new item to the end of a list.
โจ Creating Your Own Spells (Functions)
def spell_name():
Create a new spell you can use again and again!
def greet(name):
A spell that takes an ingredient (parameter).
return value
Send back a result from your spell.
๐ Your Achievements
Earn badges by completing lessons and mastering spells!