I have this code already put into a larger chunk of code, but I've narrowed it down to this as the error. I know that the error is that I am attempting to add a variable to something in a dictionary. Is there any way that I could add it to the actual stat itself?
smallGuns = 5
bigGuns = 2
unarmed = 3
meleeWeapons = 20
throwing = 4
firstAid = 2
sneak = 5
lockpick = 10
steal = 3
science = 4
repair = 3
speech = 5
choice = raw_input("Which stat do you want to add points to?")
skillPoints = 5
statlist = ['small guns', 'big guns', 'unarmed', 'melee weapons', 'throwing', 'first aid' 'sneak', 'lockpick', 'steal', 'science', 'repair', 'speech']
if choice in statlist:
pointDeduction = input("How many points do you wish to add to %s? (Up to %s points)" %(choice, skillPoints))
if pointDeduction <= choice:
choice += pointDeduction
skillPoints -= pointDeduction
else:
print "You do not have that many points to distribute to %s." %(choice)
print steal
My error message is
Traceback (most recent call last): File "F:/TARG/temp.py", line 22, in <module> choice += pointDeduction TypeError: cannot concatenate 'str' and 'int' objects