Question: For Python 3.6 Get the Guess.py code by either copying and pasting or downloading the file from the website. Get it to run for you.
For Python 3.6
Get the Guess.py code by either copying and pasting or downloading the file from the website.
Get it to run for you.
Only after you get it running, do the following:
Save the file to a new name so you can modify it.
Modify the program to accept user input for the range of numbers to guess and how many guesses you get.
Make sure you new version works with different input.
Extra : Create Play Again Loop to repeat the game using the user input range of numbers and # of guesses.
Once you have your new version running with user input, Upload your version to prove you completed the assignment.
Source Code
# This is a guess the number game. import random
guessesTaken = 0
print('Hello! What is your name?') myName = input()
number = random.randint(1, 20) print('Well, ' + myName + ', I am thinking of a number between 1 and 20.')
while guessesTaken < 6: print('Take a guess.') # There are four spaces in front of print. guess = input() guess = int(guess)
guessesTaken = guessesTaken + 1
if guess < number: print('Your guess is too low.') # There are eight spaces in front of print.
if guess > number: print('Your guess is too high.')
if guess == number: break
if guess == number: guessesTaken = str(guessesTaken) print('Good job, ' + myName + '! You guessed my number in ' + guessesTaken + ' guesses!')
if guess != number: number = str(number) print('Nope. The number I was thinking of was ' + number)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
