Created
December 13, 2017 22:24
-
-
Save amazingandyyy/b2143202d45de1ebb108c5a77c0f0e11 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
count = 0 | |
number = random.randint(1, 100) | |
while count < 11: | |
print('Take a guess from 1 ~ 100') | |
guess = input() | |
guess = int(guess) | |
count = count + 1 | |
if guess < number: | |
print('Your guess is too low.') | |
if guess > number: | |
print('Your guess is too high.') | |
if guess == number: | |
break | |
if guess == number: | |
count = str(count) | |
print('Good job! You guessed the number in ' + count + ' guesses!') | |
if guess != number: | |
number = str(number) | |
print('The number was ' + number) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment