Reputation: 865
def encrypt_message(text, x):
text = list(text)
for y in text:
ord(text)
returns ord() expected a string of length 1, but list found
Upvotes: 1
Views: 695
Reputation: 107287
The problem is that you passed the text
to ord
function you need to pass the y
.
But as strings are iterable objects you can just loop over your string :
def encrypt_message(text, x):
return [ord(i) for i in text]
Upvotes: 1