Skip to content

Instantly share code, notes, and snippets.

@Nickikku
Last active July 3, 2017 14:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nickikku/08fab3ee405b76b8df4f65205b708f23 to your computer and use it in GitHub Desktop.
Save Nickikku/08fab3ee405b76b8df4f65205b708f23 to your computer and use it in GitHub Desktop.
Guess_game
Created on Mon Jul 3 16:07:34 2017
@author: nickikku
"""
import random
d = int(random.randint(1,10))
#print(d)
e = 1
while e < 10:
c = str(input("Guess a number below 10: "))
c = c.lower() #doesn't matter how you write it.
if c == "exit":
break
c = int(c)
if c < d:
print("Guess higher!")
elif c > d:
print("Guess lower!")
if c == d:
print("Exactly right, you won. You did it in " + str(e) + " guesses")
break
e += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment