Need help fixing a game I made in Python

I have been set a task to make a fruit machine game in python, however I am facing a small problem, it involves a variable. it is saying that I have referenced the variable before it's assignment, even though I have assigned it. It seems to be reading it as a local variable instead of a global variable. How do i fix this.