todolist = []
def add_item(item):
todolist = todolist + [item]
def main():
add_item(1)
print(todolist)
if __name__ == '__main__':
main()
I am trying to make a function called add_item() which works like append() and I am not allowed to use any built in functions. I keep getting an UnboundLocalError. How would I fix this?