Ex13 - While Loops

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Ex 13 – while Loops

1. Write a program which will display the numbers from 1 to infinity 13_1.py

2. Write a program that asks the user to guess your age. The user should keep
guessing until they get it correct. 13_2.py

3. Write a guessing game for two players. The first player enters a number
between 1 and 50 (while the second user isn't looking).

Your program will then use a loop that will keep printing blank lines until the
first player’s number has been scrolled off of the screen. (You will have to
experiment to figure out how many times you need to print a blank line. Use a
constant to set the loop count. See the example on slide 18 of lesson 3-10 if
you aren’t sure how to do this.)

The second player will then try to guess the first player’s number. The
second user must keep guessing until they get it correct. If the user’s guess
is incorrect, your program should tell them whether their guess is too high, or
too low. 13_3.py

4. Create a three (3) question multiple choice quiz where each question has four
choices for the answer. Your questions should be based on information that
you have learned in this course. If the user gets a question wrong they
should keep trying until they get it correct, before they move on to the next
question. 13_4.py

You might also like