All right, I'm a novice at python, and here's the snippet of code in question:
<!-- language: lang-py -->
List = [["W","w"],["A","A"],["a","a"]]
def ascii():
x = 0
y = 0
aValues = [[],[],[]]
for item in List:
for item in List[x]:
c = "0"
c = ord(List[x[y]])
y = y + 1
aValues[x].append(c)
x = x + 1
return aValues
aValues = ascii()
print (aValues)
And, when I try to execute this, I get this error message:
>>>
Traceback (most recent call last):
File "/Users/Hersh/Desktop/Python/ascii_conversion.py", line 16, in <module>
aValues = ascii()
File "/Users/Hersh/Desktop/Python/ascii_conversion.py", line 10, in ascii
c = ord(List[x[y]])
TypeError: 'int' object is not subscriptable
>>>
What exactly is the problem, and how can I fix it?