You have not explained where the problem occurs, so I am making some assumptions here
def createList():
global aList
aList = []
You are declaring
aList
to be a
global
variable, but it does not exist in the global namespace, so it cannot be 'seen' by other functions. And your code is inconsistent as some functions use it as an input and/or return value.
You have one of two options:
1. Define
aList
in the
global
namespace by modifying your code thus:
MAX_CHAR = 126
aList = []
But that means you need the
global
declaration in every one of your functions.
2. Use
aList
as an input parameter to every function, and a return value to any that modify it.
Note also that
createList
does not need to return the size of the list, as you can find that at any point by using the
len()
built-in function.