I'm new to python so this might be a stupid question but basically im trying to make a number guessing game and there are 2 problems, the first one is that if i try to bet 50 or more coins, it doesn't let me and the second one is that the if statement that checks if you were right or wrong, seems to be ignored.
import random
import time
coins = str(100)
print("you have " + coins + " coins")
num1 = str(random.randint(1, 20))
print(num1)
highlow = input(print("do you think the next number between 1 and 20 is higher(1) or lower(2)"))
bet = str(input(print("how much coins do you want to bet?")))
if bet == coins:
print("you bet all your coins")
else:
if bet > coins:
print("you can't bet that many coins, you only have " + coins + " coins")
time.sleep(3)
quit()
else:
print("you bet " + bet + " coins")
time.sleep(3)
num2 = str(random.randint(1, 20))
print("the second number was " + num2)
time.sleep(1)
if num1 > num2:
if highlow == 1:
print("the second number was lower, you lost")
coins = coins - bet
elif highlow == 2:
print("the second number was lower, you won")
coins = coins + bet
elif num2 < num1:
if highlow == 1:
print("the second number was higher, you won")
coins = coins + bet
elif highlow == 2:
print("the second number was lower, you lost")
coins = coins - bet
time.sleep(1)
print("you have " + coins + " coins")
i tried to change the if statement around at the end so that it first checks if you guessed higher or lower but that doesn't work either.