Here is the code to the project, yes i know the game over screen is trash.
also, i am running this on trinket.io, so some stuff might not be supported.
the issue is even if i give t a number, like 2, it just gives me the "please enter a number between 1 and 3" screen.
i have no idea as to why its doing this, it might be somthing in the way of how it cheks for null inputs.
so if you have any ideas as to why it dose this, please let me know.
import random,os,time
correct = 0
continue_=1
def clear():
os.system("cls")
def prompt(prompt):
return(input(prompt))
def prompt(prompt):
return(input(prompt))
#above, defining and importing things
print "Welcome to: PRESS YOUR LUCK\n now with a 75% chance of winning"
raw_input("\nnext slide (press enter to continue)")
clear()
print "the goal... to get as many right in a row as possible\n you will pick 1, 2, or 3 if you are right you continue on\nif not you fail."
raw_input("\nnext slide (press enter to continue)")
clear()
#above, the 2 slides you see when you start the game
while continue_ == 1:
number_selected = (prompt("1, 2 or 3 \n>>>"))
random_number = random.randint(1,3)
random_number_mk2 = random.randint(1,3)
#above, prompt for asking for the input number, then the 2 random number gens
if number_selected == (1,3):
#above, part 1 of finding null inputs
if number_selected == random_number or number_selected == random_number_mk2:
correct +=1
print "good job you have got, " + str(correct) + " correct!"
time.sleep(2)
clear()
#above, if you got one of the numbers right, you get this message
if number_selected != random_number and number_selected != random_number_mk2:
print" _____ ____"
print" / ____| / __ \ "
print"| | __ __ _ _ __ ___ ___ | | | |_ _____ _ __"
print"| | |_ |/ _` | '_ ` _ \ / _ \ | | | \ \ / / _ \ '__|"
print"| |__| | (_| | | | | | | __/ | |__| |\ V / __/ |"
print" \_____|\__,_|_| |_| |_|\___| \____/ \_/ \___|_|"
print "the numbers were",(random_number),"and",(random_number_mk2),"\nyou got:",(correct),"correct!"
#if you got it wrong, you get this insted
prompt("press one to continue, press zero to quit")
if continue_==0:
exit()
else:
pass
clear()
#system to promp the user to continue, or quit
else:
clear()
print("please put a number between 1 and 3")
continue_ = 1
time.sleep(2)
clear()
#this system is part 2 of checking for no input when prompted