Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python help please Python: Number Guessing Game Write a Python function called Guess . with one input and one output. The input is a value

Python help please image text in transcribed
Python: Number Guessing Game Write a Python function called "Guess ." with one input and one output. The input is a value to guess and the output is the number of guesses needed to find the value. Set up a doc string with the information you had to enter in MATLAB. The function will use a while statement to create a number guessing game: 1. If the function is called with no input use random.randint (a,b) to generate a random number between and including a-1 and b-1000. You l also need to have import random at the start 2. Ask a player to enter a number (integer) to be guessed 3. Use a while statement to give an indication if the number is higher or lower than the guess. 4. The process repeats until the number is guessed or the player types quit. If the player guesses the number, print out the number of guesses and end the function. Hint 1: Initialize guess counter variable (i.e. guess-0) before your while statement. Hint 2: You will need an if statement to deal with game quitters Hint 3: Your conditional while statement should compare the number generated to the current guess with three possible outcomes: high, low or you win. Hint 4: Use the command- break- to end the game when you win or when you quit

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

5. How do economic situations affect intergroup relations?

Answered: 1 week ago

Question

2. Write two or three of your greatest weaknesses.

Answered: 1 week ago