convert to ascii 1

convert to ascii

#python 3.x
text = input("enter a string to convert into ascii values:")
ascii_values = []
for character in text:
    ascii_values.append(ord(character))
print(ascii_values)

Here is what the above code is Doing:
1. We are taking a string from the user and storing it in a variable called text.
2. We are creating an empty list called ascii_values.
3. We are iterating over the string and for each character in the string, we are appending the ascii value of that character to the list.
4. Finally, we are printing the list.

Similar Posts