What is the problem in this code, because I need create a empty list and I can't create a empty list.
def empty_list():
empty_list=[]
return empty_list
def text_to_list(the_text):
empty_list=empty_list()
empty_list[:0]=the_text
return empty_list
# The print to show the result.
print(text_to_list("ABCD"))
The result:
Traceback (most recent call last):
File "./prog.py", line 9, in <module>
File "./prog.py", line 5, in text_to_list
UnboundLocalError: local variable 'empty_list' referenced before assignment