Learn Python Basics in One Afternoon
Print your first message, store information in variables and make the computer repeat things for you.
Python is one of the friendliest languages in the world. It reads almost like English, which means you can spend less time fighting punctuation and more time building cool things.
Your very first line of code
Every coder starts with a greeting. The print() command tells the computer to say something out loud on the screen.
1print("Hello, Kodland!")
Boxes called variables
A variable is like a labelled box. You put something inside it and use the label whenever you need it again.
1name = "Adam"
2age = 11
3print("Hi " + name + ", you are " + str(age) + " years old!")
Make the computer repeat itself
Loops save you from typing the same thing over and over. This one counts to five and cheers at the end.
1for number in range(1, 6):
2 print("Step", number)
3
4print("Done! You just ran a loop.")
Try it yourself
Build a tiny quiz that asks a question and reacts to the answer.
- 1Ask for a name with input() and greet the person.
- 2Ask a maths question like 7 x 8 and store the answer.
- 3Use if and else to print 'Correct!' or 'Try again!'.
- 4Wrap it in a loop so the quiz asks three questions.
Keep going
Draw Rainbow Art with Python Turtle
Turn a few lines of code into spinning rainbow spirals using Python's built-in drawing robot.
Redstone Is Really Just Computer Logic
Doors, traps and secret bases: learn AND, OR and NOT gates by building them out of redstone.
Debugging Like a Pro (Even When You Are 10)
Errors are not failures, they are clues. Here is the routine real developers use to squash bugs.