Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Python Code: The computer will generate a random number from 1-10 (inclusive). The user will guess a number. You will print different messages depending on
Python Code:
The computer will generate a random number from 1-10 (inclusive). The user will guess a number. You will print different messages depending on how close the guess was.
Example - Assuming the computer's number is 7
Welcome to the Guessing Game The Computer has picked a number from 1 - 10. Try to match it. What number do you choose (1-10): 4 You picked 4, and actual number was 7. Youngling, your time will come.
The last messages are as follows:
- Exact match: Honored to play with you, Master.
- Off by 1: You are a worthy opponent, Knight.
- Off by 2: You have much to learn, Padawan.
- Off by 3: Youngling, your time will come.
- Off by 3+:Keep working hard in the Service Corps.
Code Requirements
- You may have only one print statement after the user makes their pick
- You may assume the user will give proper input
- You may not use nested if-statements or multiple single if-statements.
- Make sure to read the rubric for all grading details.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started