I'm fairly new to python and I'm currently working on a program that will encrypt and decrypt strings. As part of it, I need the individual letters of the string to each be added to an empty list; for example, the string 'hello' would be entered into a list list like so:
['h','e','l','l','o']
The part of the code that is giving me this error can be found below. Thanks.
emptyList=[]
message=input("What Would You Like To Encrypt?\n")
messageLength=len(message)
for count in range(0,messageLength):
emptyList=[]
emptyList[count].append(message[count])
emptyList[0]does not exist whenemptyListis[]. You might want toempyList.append(message[count]). That said, it'd likely be easier to doemptyList = list(message)