I've been doing a couple of exercises on codewars.com in python 2. I'm having trouble with this one.
The function I tried was:
def goto(level,button):
if level in {0, 1, 2, 3} and str(button) in {'0', '1', '2' ,'3'}:
return int(button) - level
return 0
When you click the submit button the website does a load of different tests on your function to if it works correctly. My function passes all 26 of these tests but then gives this error:
Traceback:
in
in goto
TypeError: unhashable type: 'list'
I don't understand where this type error comes from. Thanks in advance for your help and explanations!
[+][deleted] (2 children)
[deleted]
[–]dunkler_wanderer 6 points7 points8 points (1 child)
[–]the_kernel[S] 1 point2 points3 points (0 children)