GUESS THE NUMBER
Just looking for a way to end this function and then do an aimForTarget game with a menu driven program
import random
def guessTheNumber(guessing):
```return guessing```
secretNumber = random.randint(1, 50)
print('I am thinking of a number between 1 and 50.')
for guessesTaken in range(1, 10):
print('Take a guess')
guess = int(input())
if guess < secretNumber:
print('Your guess is too low.')
elif guess > secretNumber:
print('Your guess is too high.')
else:
break
if guess == secretNumber:
print('Good Job! You guessed my number in ' + str(guessesTaken) + ' guesses!')
else:
print('Game Over. You used up all your tries. ' + str(secretNumber))
Aucun commentaire:
Enregistrer un commentaire