What I'm trying to do is make a function that subtracts the total value of another variable from the main one. I tried to create this but failed... I tried doing this.
def punch():
b = random.randint(0,100)
goblinhp = 100
goblinhp = goblinhp - int(b)
print("Goblin's HP is Now: " + goblinhp)
opt = input("What do you want do? (punch/kick/heal): ")
if opt == "punch":
punch()
but, in return, it showed these error messages.
Traceback (most recent call last):
File "main.py", line 79 in <module>
punch()
File "main.py", line 76 in punch
print("Goblin's HP is Now: " + goblinhp)
TypeError: can only concatentate str (not "int") to str
what caused these errors, and how can I fix them.