the pun-tastic programming challenge
Learn fundamental Python sequencing by building an interactive joke generator terminal.
Imagine you're trying to impress your friends with a really good joke, but you want to make sure you deliver the punchline at just the right moment for maximum impact! In the digital world, we can program our computers to do exactly that. Your mission is to write a simple program that tells a joke, building suspense by waiting for someone to press a key before revealing the hilarious conclusion. Get ready to add some digital humour to your coding skills!
Required Prior Learning
Displaying text on the screen (using
print())Getting simple input from the user (using
input())Use
Investigate & PredictLet's explore how computers can show messages and then pause for your input. Take a look at the Python code in the box below. It's a simple example that doesn't tell a joke, but it shows the key ideas we'll be using. Try running it and see what happens!
Prediction Questions
1
Before you run the code, what do you think will happen when the program reaches the line
input("Press Enter to continue...")?2
What would happen if you removed the
input() line completely? Would the program still work the same way?3
How many lines of text will appear on the screen before you press the Enter key?
Modify
Tweak & ExperimentTake the starter code in the widget above and experiment with the following changes:
1
Change the message that asks the user to press Enter. For example, try changing it to
input("Ready for the answer?").2
Add an extra
print() statement right before the input() line. What effect does this have on the program's flow?3
Modify the last
print() statement to display a different colour. Try changing "Mine's blue!" to "Mine's green!".Create
The Core ChallengeNow it's time to bring your joke to life! Using the skills you've just practised, create a program that delivers a joke with a perfectly timed punchline, just like our scenario.
Success Criteria
Your program should first display the setup of a joke.
It must then wait for the user to press the Enter key before proceeding.
After the user presses Enter, the program should reveal the punchline.
Extension: Make the punchline stand out by displaying it in a different colour!
Test and submit
Fit for purpose?Run your code and check it against the expected behaviour below:
User Action
Expected Output
Purpose of Test
Run the program
The joke setup is displayed, then the program pauses with a blinking cursor.
Verify the joke setup appears correctly and the program waits for input.
Press the Enter key
The joke punchline is displayed immediately after pressing Enter.
Confirm the program responds to input and reveals the punchline.
Run the program (if extension attempted)
The punchline is displayed in a noticeable different colour than the setup.
Check that the punchline colour change is working as intended.
Finally, click the printer button to save your solution for your teacher.
Last modified: October 22nd, 2026
