Set up in five minutes
- Download Python free from python.org. On Windows, tick “Add Python to PATH” during installation.
- Open IDLE, which comes with Python, or install Thonny, a very beginner friendly editor.
- Choose File, New File, type your program, save it with a .py name and press F5 to run.
No install? Online editors such as Trinket or Replit run Python in a browser.
Program 1: hello you
name = input("What is your name? ")
print("Hello, " + name + "!")
Learn: input, output, variables and joining strings.
Program 2: age next year
age = int(input("How old are you? "))
print("Next year you will be", age + 1)
Learn: converting text to a number with int().
Program 3: pass or fail
score = int(input("Enter your score: "))
if score >= 50:
print("You passed!")
else:
print("Keep practising.")
Learn: selection with if and else, and indentation.
Program 4: times table
number = int(input("Which times table? "))
for i in range(1, 13):
print(i, "x", number, "=", i * number)
Learn: FOR loops and range.
Program 5: guess the number
import random
secret = random.randint(1, 20)
guess = 0
while guess != secret:
guess = int(input("Guess 1 to 20: "))
if guess < secret:
print("Higher")
elif guess > secret:
print("Lower")
print("You got it!")
Learn: WHILE loops, random numbers and elif.
Good habits from day one
- Use meaningful variable names.
- Run your code often, after every few lines.
- Read error messages from the bottom line up.
- Change one thing at a time when fixing a bug.
Got an error? The Python Emergency Kit explains the common ones. Ready for more? Try the Python projects pack.

