When I try to run this code
budget = 500
x = 1
y = 1
bet = 0
totalsum = 0
x = input("enter result:")
bet = input("enter bet:")
y = input("you bet on?:")
if x == y:
bet = (bet) * 2
totalsum = budget + bet
budget = totalsum
print("your winnings:", totalsum)
print("your budget:", budget)
if x != y:
totalsum = budget - bet
budget = totalsum
print("your winnings:", totalsum)
print("your budget:", budget)
if budget < 0:
print("you lost :(")
I get a console error:
Traceback (most recent call last):
File "main.py", line 19, in
totalsum = budget + bet TypeError: unsupported operand type(s) for +: 'int' and 'str'
Program finished with exit code 1
I don't understand why. Both those values are set to have a numerical value so why is one of them a string? (I think that it what it means by 'str')