Python Riddles

Let’s write a program that tells some riddles. Along the way you will learn about using if/elif/else statements in Python.

Click here for a video explanation of if/else statements

Start a new Python program in Codehs sandbox. Name it yourlastname_riddles like this: milstead_riddles.

Here’s some sample code to get you started. Type this into your new program.

You will notice a new module is imported on line 1 – import time. This module allows you to slow down your program by using time.sleep(number of seconds). If you type in time.sleep(1) your program will pause for 1 second.

After you type in the code below, add two more riddles of your own and turn it in on Canvas. Click here for 101 riddles to choose from.