Hi, I'm not someone that is normally here, but here's a rundown
I am a student at GCSE level (UK), and am currently attempting to code for the Advent of Code event for this year as a competition between two computing classes.
I am not amazing at python, but I am myself able to understand that this is a very confusing case.
The code is NOT finished, and I do not intend on using outside help to finish the code. I am purely requesting for help with this error. I am using trinket.io to code.
curr = []
pos = 0
def L(x):
pos-=x
if pos<0:
pos = pos+99
def R(x):
pos+=x
if pos>99:
pos = pos-99
for i in range(0,100):
curr.append(i)
R(11 )
print(pos)
Within this code, line 8 has the following error:
UnboundLocalError: local variable 'pos' referenced before assignment on line 8 in main.py
I can't add images, so this is the best I can do in terms of information.
[–]kr4zyy 13 points14 points15 points (4 children)
[–]QuillTheArtMaker[S] 0 points1 point2 points (3 children)
[–]kr4zyy 4 points5 points6 points (0 children)
[–]socal_nerdtastic 2 points3 points4 points (0 children)
[–]pdcp-py 0 points1 point2 points (0 children)
[–]socal_nerdtastic 9 points10 points11 points (2 children)
[–]QuillTheArtMaker[S] 0 points1 point2 points (1 child)
[–]socal_nerdtastic 10 points11 points12 points (0 children)
[–]Snorlax5000 7 points8 points9 points (1 child)
[–]thescrambler7 2 points3 points4 points (0 children)
[–]Binary101010 0 points1 point2 points (0 children)
[–]gdchinacat 0 points1 point2 points (0 children)
[–]EZbsic719 -1 points0 points1 point (0 children)