We want to develop a game where the user should guess a secret number. The game asks the user to input a number and tells how close it is to the secret random number that the game generates Complete the main() function that implements this game by calling the get_user_input().generate_secret(), and display_result(user_input, secret) functions that you will develop as follows: • Complete the get_user_input() function so that it prompts the user to enter a whole number between 1 and 20 (inclusive) and returns the number that the user enters. • Complete the generate_secret() function so that it generates and returns a random number between 1 and 20 (inclusive). • Complete the display_result(user_input, secret) function that takes the two parameters that correspond to the user input and the secret. It should then print the absolute difference between these two numbers. For example: Test random seed(10) 5 Input Result Enter a number from 1 to 2015 You entered 5. The secret was 19. The difference is 14.

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter8: Advanced Data Handling Concepts
Section: Chapter Questions
Problem 2GZ
icon
Related questions
Question
We want to develop a game where the user should guess a secret number. The game asks the user to input a number and tells how close it is to the secret random number that the game
generates.
Complete the main() function that implements this game by calling the get_user_input(), generate_secret(), and display_result(user_input, secret) functions that you will develop as
follows:
• Complete the get_user_input() function so that it prompts the user to enter a whole number between 1 and 20 (inclusive) and returns the number that the user enters.
• Complete the generate_secret() function so that it generates and returns a random number between 1 and 20 (inclusive).
• Complete the display_result(user_input, secret) function that takes the two parameters that correspond to the user input and the secret. It should then print the absolute difference
between these two numbers.
For example:
Test
Input Result
random.seed (10) S
Enter a number from 1 to 2015
You entered 5. The secret was 19. The difference is 14.
Transcribed Image Text:We want to develop a game where the user should guess a secret number. The game asks the user to input a number and tells how close it is to the secret random number that the game generates. Complete the main() function that implements this game by calling the get_user_input(), generate_secret(), and display_result(user_input, secret) functions that you will develop as follows: • Complete the get_user_input() function so that it prompts the user to enter a whole number between 1 and 20 (inclusive) and returns the number that the user enters. • Complete the generate_secret() function so that it generates and returns a random number between 1 and 20 (inclusive). • Complete the display_result(user_input, secret) function that takes the two parameters that correspond to the user input and the secret. It should then print the absolute difference between these two numbers. For example: Test Input Result random.seed (10) S Enter a number from 1 to 2015 You entered 5. The secret was 19. The difference is 14.
Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,