Good morning everyone! I am new to programming and am learning python. I am trying to create a function that converts each individual char in string into each corresponding individuals ints and displays them one after another. The first error it generates is "c is not defined".
c=''
def encode(secret_message):
for c in secret_message:
int_message=+ord(c)
return int_message
Example of what I want it to do:
secret_message='You' (this is a string)
return: 89 111 117 (this should be an int, not a list)
note: 'Y'=89, 'o'=111, 'u'=117
the idea is that encode takes in a parameter secret message. It then iterates through each char in c and converts each char from a string to an int. Then it returns the entire message in ints.
I'm also not sure how to get each char to appear in int_message. As of now, it looks like it will add all the ints together. I want it to simply place them together (like a string). Do I need to convert it back to a string after I get the int values then concatenate?