Skip to content

Instantly share code, notes, and snippets.

@amazingandyyy
Created December 13, 2017 22:24
Show Gist options
  • Save amazingandyyy/b2143202d45de1ebb108c5a77c0f0e11 to your computer and use it in GitHub Desktop.
Save amazingandyyy/b2143202d45de1ebb108c5a77c0f0e11 to your computer and use it in GitHub Desktop.
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