Last active
July 3, 2017 14:31
-
-
Save Nickikku/08fab3ee405b76b8df4f65205b708f23 to your computer and use it in GitHub Desktop.
Guess_game
This file contains 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
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