Ask coding questions

← Back to all posts
TypeErrors, need help!
y33t3rs0n

I'm adding on to a tutorials monster-fighting type game and I'm getting two errors, one: Traceback (most recent call last):
File "main.py", line 44, in <module>
attack()
TypeError: attack() missing 9 required positional arguments: 'lives', 'weapon_damage', 'coins', 'monsters_killed', 'bright_yellow', 'bright_blue', 'green', 'bright_red', and 'bright_cyan'

and also:
Traceback (most recent call last):
File "main.py", line 54, in <module>
print(bright_yellow + "\nYou have" + coins + "coins!!")
TypeError: can only concatenate str (not "int") to str

Answered by VulcanWM [earned 5 cycles]
View Answer
Voters
y33t3rs0n
Comments
hotnewtop
VulcanWM

for the traceback have you tried doing: print(bright_yellow + "\nYou have" + str(coins) + "coins!!") ?

VulcanWM

and for the first error to run the attack function you have to provide all the 9 required positional arguments @VulcanWM

y33t3rs0n

@VulcanWM so can I just not include arguments I'm not using and it will be fixed?

VulcanWM

yeah just remove the arguments you don’t need from when you’re defining the function and it’ll work @y33t3rs0n

y33t3rs0n

I've tried fixing both before