Python
Number Guessing Game
“You guess. The computer hints. Simple joy.”
What you will have
A game where the computer picks a random number between 1 and 20 and you guess until you get it right.
After each guess it tells you too high or too low. When you win it tells you how many tries it took. You can play again without restarting.
Video walkthrough
Prefer to watch? Follow along with the full video.
Watch Greg build the number guessing game live — copying the prompt, pasting into ChatGPT, running it in IDLE, and making the Vibe Tweak. Pause and rewind as many times as you need.
Enjoying the videos? Subscribe on YouTube for every new lesson →
Your prompt
Copy this. Paste it into your AI. Hit Enter.
📋 Your Prompt — Copy Everything Below
Create a Python number guessing game. The computer picks a random number between 1 and 20. The player guesses. After each guess, tell them “too high” or “too low”. When they guess correctly, celebrate and tell them how many tries it took. Allow them to play again without restarting the program.
✅ Copied! Now paste it into your AI.
What to do after
Follow these steps exactly.
1
Copy all the code from your AI
Select all and copy.
2
Open IDLE → File → New File
A blank editor window will open.
3
Paste and save as guess.py
Ctrl+V → File → Save As → guess.py.
4
Press F5 to run and play
Type a number and hit Enter. Try to win in as few guesses as possible.
🛠️ Didn’t work?
Don’t panic. Here’s exactly what to do:
1 Copy the error from the IDLE window
2 Go back to your AI chat
3 Say: “This didn’t work. Here’s the error: [paste it]. Please fix it.”
Vibe Tweak
Make it harder.
Find the number 20 — that’s the top of the range. Change it to 100. Save and press F5.
Find this
randint(1, 20)
→
Change to this
randint(1, 100)
Extra Credit
Want to go further?
📋 Extra Credit Prompt
Add a difficulty menu to the guessing game. Before the game starts ask the player to choose: Easy (1-10), Medium (1-50), or Hard (1-100). Set the range based on their choice.
✅ Copied!
Reflection
Before you move on — think about this.
“How many guesses did it take you to win? Can you find the line that picks the random number? What does the word ‘random’ tell you about what that line does?”