

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
The objectives and planning for a python programming exercise called 'the higher or lower game'. The game involves generating a random number between 1 and 100, and asking the user to guess the number. How to use variables, if-else statements, and loops to implement the game. Extensions to the game include allowing the user to choose the difficulty level, counting attempts, and giving a rating based on score.
What you will learn
Typology: Study notes
1 / 2
This page cannot be seen from the preview
Don't miss anything!
By the end of this lesson you should be able to: Generate a random number Ask the user for a value and store it in a variable Use an IF…ELIF…ELSE statement You might be able to: Use a WHILE loop to repeat code until some rule is met Use a counter to keep track of how many times you have used a loop
You have been asked to write a simple version of the “higher – lower game”. The game works like this:
You will need to use 2 variables. Choose a suitable name for the variable that will hold the target number : Choose a suitable name for the variable that will hold the guess :
Tick the box if you are able to: Generate a random number Ask the user for a value and store it in a variable Use an IF…ELIF…ELSE statement Use a WHILE loop to repeat code until some rule is met Use a counter to keep track of how many times you have used a loop