Here are three tiny programs. Each one is real โ every program on this page was run on a real Python before this page was written, and the "What you should see" parts show what really happened. Your job:
1. Tap the ๐ Copy button on a program. 2. Paste it into IDLE, Python's practice app. 3. Save it, run it, and watch it work. 4. Then change one small thing and see what happens โ that is how you learn.
Pick your grade:
1. Open IDLE. It came with your Python. (Windows ยท Mac ยท Chromebook)
2. Open the File menu and start a new file.
3. Tap a program's ๐ Copy button here, then paste into the new file.
4. Save the file. Its name should end in .py โ Python programs end in .py.
5. Open the Run menu and choose Run Module (you can also press F5). IDLE runs your program in its Shell window.
That is the whole routine. IDLE's own guide says: files with a .py extension hold Python code, and you run it with the Run menu โ the item is called Run Module (F5).
turtle.py or random.py!Python has built-in tools called turtle and random. If your program's file has the same name as one of those tools, Python will grab YOUR file instead of the real tool and get confused. IDLE's own guide warns about exactly this โ the fix is to rename your file. Use the safe names on this page: hello.py, spiral.py, and guess.py.
This program asks your name, then says hello back to you.
# Program 1: Say Hello
name = input("What is your name? ")
print("Hello, " + name + "!")
print("I am glad you are learning Python, " + name + ".")What you should see: Python asks the question, then waits. Type your name (we typed Alex) and press Enter:
What is your name? Alex
Hello, Alex!
I am glad you are learning Python, Alex.
How it works: input asks a question and saves your answer in a box called name. print glues words together with + to make your greeting.
โญ Try changing this: Change the word Hello to Howdy. Or make the question ask about your favorite color, too.
This program teaches a little turtle to draw a spiral that grows and grows.
# Program 2: Turtle Spiral
import turtle
turtle.color("blue")
for steps in range(100):
turtle.forward(steps)
turtle.right(30)
turtle.done()What you should see: A new window opens. A little arrow โ the turtle โ draws a blue spiral that grows bigger and bigger as it goes around. The last line, turtle.done(), keeps the window open so you can admire your picture. (On our test screen the drawing ran clean, with no errors, and the turtle's window stayed open just like the docs say it should.)
How it works: import turtle brings in the drawing turtle. for steps in range(100) repeats the job 100 times. Each time, the turtle walks a little further (forward(steps)) and turns 30 degrees (right(30)). Because the steps get bigger each round, the spiral grows.
โญ Try changing this: Change right(30) to right(90) and watch it draw a square spiral. Or change "blue" to "red".
The computer picks a secret number. You guess it. It gives you hints until you win.
# Program 3: Guess the Number
import random
secret = random.randint(1, 10)
guess = 0
while guess != secret:
guess = int(input("Guess a number from 1 to 10: "))
if guess < secret:
print("Too low! Try again.")
elif guess > secret:
print("Too high! Try again.")
else:
print("You got it! The number was", secret)What you should see: The computer picks a secret number you cannot see. Here is part of the test run from before this page was written โ the secret that time was 9:
Guess a number from 1 to 10: 5
Too low! Try again.
Guess a number from 1 to 10: 9
You got it! The number was 9
Your secret number will be different every time โ that is the game!
How it works: import random brings in the number picker. random.randint(1, 10) picks a whole number from 1 to 10, and both ends count. The while loop keeps asking until your guess equals the secret number. The if / elif / else part gives you a hint each time.
โญ Try changing this: Make the secret number come from 1 to 20. Change BOTH 10s โ the one in randint(1, 10) AND the 10 in the question words.
import โ the word that brings a ready-made tool into your program. import random brings the number picker; import turtle brings the drawing turtle.
Run Module โ the IDLE menu choice (Run โ Run Module, or F5) that runs the program you saved.
Shell โ IDLE's window where your program's answers appear.
Event loop โ the turtle's way of waiting: after turtle.done(), it keeps the drawing window open until you close it.
Secret number โ a number the computer picks that you cannot see, until you guess it.
Want more pieces to play with? The Python Cheat Sheet for Kids has every command from these programs โ plus lists, functions, and more.
No Python on your computer yet? Start with an install page: Windows ยท Mac ยท Chromebook.
docs.python.org โ "turtle โ Turtle graphics" (the turtle's forward/right/color commands, the pattern loop, turtle.done(), and the tkinter note): https://docs.python.org/3/library/turtle.html
docs.python.org โ "random โ Generate pseudo-random numbers" (randint(a, b): "Return a random integer N such that a <= N <= b"): https://docs.python.org/3/library/random.html
docs.python.org โ The Python Tutorial, "An Informal Introduction to Python" and "More Control Flow Tools" (while loops, if/elif/else, input): https://docs.python.org/3/tutorial/introduction.html ยท https://docs.python.org/3/tutorial/controlflow.html
docs.python.org โ "IDLE โ Python editor and shell" (Run Module (F5), .py files, and the warning against naming your file after a standard library module like random.py): https://docs.python.org/3/library/idle.html
All three programs were run with Python 3.12.3 on November 7, 2026, before this page was written. The hello and guess-the-number programs ran start to finish with exit code 0 (the guess game was fed guesses 1 through 10 in order and won on 9). The turtle spiral ran on a virtual display; its drawing finished with no errors and turtle.done() held the window open as documented. Checked against the sources above on November 7, 2026.