UnboundLocalError question.
I'm learning to code in python, and to challenge myself and get some good practice i decided to try to make a simple card game. The link to the code is below: https://code.sololearn.com/cL0plOMlcUp3/#py when i run this code, I get an error message: Traceback (most recent call last): File "..\Playground\", line 81, in <module> rollvalue() File "..\Playground\", line 70, in rollvalue if y in hearts: UnboundLocalError: local variable 'hearts' referenced before assignment This doesn't make any sense to me because the dictionaries containing all the cards in each suit are clearly defined/assigned. additionally, they can be called by one of the defined functions (rollsuit())but not the other (rollvalue()). If anyone has more experience than me in stuff like this and some time to sink into my little problem, I'd appreciate some clarity. Thank you.