Ask coding questions

← Back to all posts
How do I make this variable work?
MisledWater79 (0)

I’m trying to make it print disk00 and then shift it over one which works but its saying that the local variable disk00 referenced before this assignment.

Answered by SixBeeps (5228) [earned 5 cycles]
View Answer
SixBeeps (5228)

In your main method, add this line towards the top:

global disk00

This will make it so that Python doesn't treat it as a local variable.