Question: Programming Challenge ( 1 0 points ) Write a Python program, number _ guess.py , to play a guessing game. The program should generate a

Programming Challenge (10 points)
Write a Python program, number_guess.py, to play a guessing game. The program should generate a random number between 1 and 100 inclusive. Then, the program should ask the user to guess the number. If the user's guess is higher than the random number, the program should display "Too high, try again." If the user's guess is lower than the random number, the program should display "Too low, try again." If the user's guess is equal to the random number, the program should display "You got it in x tries.", where x is the number of guesses the user took to get to the right number.
Your program should use at least three functions: main, pick_number, and respond, where the functions have these responsibilities:
main: main should control the operation of the program, calling pick_number and respond as needed. main should also keep track of the count of the user's tries to guess the number.
main should finally print the number of tries the user needed to guess the number.
pick_number: pick_number should use random to choose a number between LOWEST and HIGHEST inclusive, where LOWEST and HIGHEST are global constants defined near the top of the program. pick_number should return the chosen number to main.
respond: respond should take number and guess as parameters where number is the value chosen by the program and guess is the number chosen by the user. respond should print the appropriate message, either "Too high, try again." or "Too low, try again.".
Here a sample output from the program:
 Programming Challenge (10 points) Write a Python program, number_guess.py, to play

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!