I am a beginner programmer using Python, and I am trying to create encryption software (Beginner). I am looking for something like:
Input: Apple -> A, P, P, L, E -> ord() -> 97,"","","","" -> hex() -> 0x16, "","" ,"" ,""
However, I cannot find a way to translate my characters to integers while accounting for an unknown amount of characters in input.
Sentence = list(input("Enter"))
print(Sentence)
ord_sentence = []
for each in range(len(Sentence)):
ord_sentence.append(ord(Sentence[]))
This then doesn't work because the argument at the end of Sentence is empty, but I don't know how to make it fill with each individual character. I could try
...
...
while len(ord_sentence) <= len(Sentence)
ord_sentence.append(ord(sentence[0]))
ord_sentence.append(ord(sentence[1]))
##Continues on to 1000 to account for unknown input##
But then, I run into INDEX ERROR when the input isn't exactly 1000 characters long, and putting something like:
...
ord_sentence.append(ord(sentence[0]))
if IndexError:
print(ord_sentence)
break
Only results in it printing the first digit of the sequence, and then breaking.
Any help would be greatly appreciated! Thank you!!!