I am having a nightmare, I have created a code in Python to simulate a virtual queue.
The code is simplistic but should work, except for the reoccurring 'UnboundLocalError'
I keep getting.
I think the issue is having 'aList'
as a parameter for functions and having the variable in the main code as well as within def
functions.
The code isn't that long and can be found on this link.
Please can somebody help? I've tried adding 'global aList'
but it didn't solve it.
Thanks very much for any assistance.
Snapshot of code below :
def aRemove(aList):
newlist = []
for i in range(1,len(aList)):
newlist.append(aList[i])
aList = newlist
return (aList)
user_request()
aList = ["mark","jon","peter"]
aList = (aRemove(aList))
print(aList)