Guess the Number Week 5
You will add to the program you created in Week 4. This week you will add input validation and a count to show how many guesses the user took before getting the correct number. Be sure to import random at the beginning of your code and use a comment block explaining what your program does.
#Guess the number week 5
#Random number, loop while true
#ask user for number. Check to see if the value is a number between 1 and 10
#if number is too high or too low, tell user, if they guessed it break out of loop
Display “Welcome to my Guess the number program!”
random mynumber
while True
Display “Guess a number between 1 and 10”
Get guess
while guess<1 or guess>10
Display “Guess a number between 1 and 10”
Get guess
Display “numbers only”
if (guessmynumber)
Display “Too high”
else if (guess==mynumber)
Display “You guessed it in “+ count + ” attempts”

Expected Result of Program:

New Download