I've recently being self teaching python and I'm making my first attempt at a game. The idea is the user must guess what the answer is (integer) My code is not yet complete but the first half won't work.
My code:
highest = 10
answer = 7
guess = int(input("What is your guess?"))
def guessingGame():
print("try again please")
guess = int(input("what is your guess?"))
while (int(guess) != answer):
if (int(guess) < answer):
print ("Answer is higher!")
guessingGame();
elif (int(guess) > answer):
print ("Answer is lower!")
guessingGame();
No matter whether I enter a value less then the answer(which is 7) or higher, It will always say ;"The answer is higher!" What am I doing wrong? Thanks!
EDIT: I'm also aware my code might be incredibly buggy/poorly written and would love any criticism/improvements.