Exercise: Loop Constructs
Practice what we have learned about loop constructs.
Exercise
Write a game called “More or Less.” The first participant chooses any number from 1 to 100. The second participant tries to guess it in seven tries.
Our script chooses a number. The user enters their guess. The script answers if the guess is more or less than the chosen number. The user then tries to guess the number six more times.
# Write your code here.
Solution
The player has seven tries to guess a number. The same algorithm handles each try. Therefore, we can apply a loop with seven iterations.
Here is the algorithm for processing a ...