So I'm given a skillbook where several characters are given some specific damage points based on what the character did, and I'm supposed to calculate the total damage each character put based on what they have...
Here is an example
skillerz = {
'mage': {'punch':10, 'spellcast':50},
'shielder': {'punch': 5 },
'vanguard': {'quickpunch':10, 'punch':20, 'kick':30}
}
killa(skillerz, [('mage','punch'), ('mage','punch')]) == 20 # each mage's punch deal 10 damage
killa(skillerz, [('mage','punch'), ('vanguard','punch')]) == 30 # each vanguard's punch deal 20 damage, so the total is 10+20 = 30
killa(skillerz, [('mage','spellcast'), ('vanguard','punch'), ('vanguard','punch')]) == 90
killa(skillerz, [('vanguard','punch'), ('vanguard','kick'), ('shielder','punch')]) == 55
Here is what I have tried...
def killa(skill_book:dict[str,dict[str,int]], combat_log:list[tuple[str,str]]):
for x in skill_book:
if x in combat_log:
return sum(x)
However, this doesn't work and there is an error. What changes to my code should I make so that the output returns correctly like the examples I provided??
Edit: My error reads Syntaxerror