Created
September 21, 2018 12:30
-
-
Save XChrisUnknownX/d22d8a01daa8ffdd3f6f668369f05269 to your computer and use it in GitHub Desktop.
one of 10.py
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
import random | |
import time | |
#joke program. succinctly the computer picks a number between 1 and 10 and you try to guess it. There is a 1/10 chance it will lie to you. | |
print("Hello. My name is Blade. I am a computer program. Let's play a game. I will choose a number between 1 and 10. I will choose a new number after each guess.") | |
while True: | |
print() | |
bladeisaliar = random.choice([False,False,False,False,False,False,False,False,False,True]) | |
bladepicksanumber = random.randint(1,10) | |
bladepicksanumbers = str(bladepicksanumber) | |
print("Pick a number between 1 and 10.") | |
print() | |
player = input() | |
try: | |
check = int(player) | |
except: | |
print("You didn't choose a number.") | |
continue | |
if check > 10: | |
print("You chose a number greater than 10.") | |
continue | |
elif check < 1: | |
print("You chose a number less than 1.") | |
continue | |
else: | |
pass | |
if bladeisaliar == True and bladepicksanumber == check: | |
print("Sorry. You didn't pick the correct number.") | |
elif bladeisaliar == False and bladepicksanumber == check: | |
print("You picked the correct number.") | |
elif bladeisaliar == True and bladepicksanumber != check: | |
print("You picked the correct number.") | |
else: | |
print("Sorry. You didn't pick the correct number.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment