0

I was writing this little game, but it's not working. I checked the code and it looks fine, but the output shows a 'EOFerror' when it is run. Can someone help?

x = 0 y = 100 print("welcome to my guessing game! i can guess your number btwn 1 and 100!") print("pick a number...") sleep(3) print(" OK, Lets go!") avg = (x + y)/2 while True: question = print("is your number higher or lower than "avg"? Please type 'higher' for higher, 'lower' for lower, or 'neither' if the guess is correct.") print(question) guess = input() if guess == 'higher': x = (x + y)/2 continue elif guess == 'lower': y = (x + y)/2 continue elif guess == 'neither': print("is" avg "your number?") if guess == 'y' print("i got it!") else: print("you tricked me!")

22nd Sep 2016, 1:12 PM
1-up Man
1-up Man - avatar
1 Odpowiedź
0
from time import sleep x = 0 y = 100 print("welcome to my guessing game! i can guess your number btwn 1 and 100!") print("pick a number...") sleep(3) print(" OK, Lets go!") while True: avg = (x + y)/2 question ="is your number higher or lower than "+str(avg)+"? Please type 'higher' for higher, 'lower' for lower, or 'neither' if the guess is correct." print(question) guess = input() if guess == 'higher': x = (x + y)/2 elif guess == 'lower': y = (x + y)/2 elif guess == 'neither': print("is" +str(avg)+ "your number?") if guess == 'y': print("i got it!") break else: print("you tricked me!")
24th Sep 2016, 8:37 AM
மனோஜ்குமார் பழனிச்சாமி
மனோஜ்குமார் பழனிச்சாமி - avatar