Note: Homework assignments should be completed in identified pairs (not more than two students), but may be done individually as well. As a pair, you should submit your assignments separately, but you will receive the same grade as your partner.
In this assignment, you will make a game to help students learn the factors of two, three, and five. The player enters the minimum number (min), the maximum number (max) and a direction (up
or down
) depending on whether they want you to count up or down.
up
iterate over all the numbers
from min to max (inclusive).down
iterate over all the numbers
from max to min (inclusive).For each number
, if the number is a multiple of:
min + 1
."Sorry, I'm too tired to play again..."
or "Ok, here we go...."
."Ok, here we go..."
is outputed, then you should ask them for a new set of min, max, and up/down inputs."Thanks for playing!"
Here is an example output of the game:
Min:3
Max:12
Direction (up/down):down
0 3 6 9 12
10 five golden rings!
0 3 6 9
4 6 8
0 3 6
5 five golden rings!
4
0 3
Would you like to play again (Y or y for Yes)?y
Ok, here we go....
Min:3
Max:12
Direction (up/down):up
0 3
4
5 five golden rings!
0 3 6
4 6 8
0 3 6 9
10 five golden rings!
0 3 6 9 12
Would you like to play again (Y or y for Yes)?y
Ok, here we go....
Min:1
Max:2
Direction (up/down):up
2
Would you like to play again (Y or y for Yes)?y
Sorry, I'm too tired to play again...
Note: You are prohibited from creating lists
in your solution to this homework assignment.
The submission:
hmwk5.py
and runs without syntax errorsThe program:
Your submission must include the course header at the top.
Last Submission March 3, 2020 at 10:00PM (EST). Go to our Moodle page. Submit your hmwk5.py
file and fill out your self-assessment.