“Converter letras em números em python” Respostas de código

Converter letras em números em python

Convert Letters to Numbers in Python using ord() method
text= "itsmycode"
num_list = []

# iterate each characters in string
# and convert to number using ord()
for c in text:
   num_list.append(ord(c) - 96)

# print the converted letters as numbers in list
print("After converting letters to numbers",num_list)
Gorgeous Gazelle

Transforme os caracteres em alpgabetic numper python

text = input()

def encrypt(t):
    chars = list(text)
    allowed_characters = list(" abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789,.?!")

    for char in chars:
        for i in allowed_characters:
            if char == i:
                chars[chars.index(char)] = allowed_characters.index(i)
    return chars

print(encrypt(text))
Itchy Ibex

Respostas semelhantes a “Converter letras em números em python”

Perguntas semelhantes a “Converter letras em números em python”

Mais respostas relacionadas para “Converter letras em números em python” em Python

Procure respostas de código populares por idioma

Procurar outros idiomas de código