decode_cesar.py

Created by thierry-barry

Created on May 02, 2020

531 Bytes

fait le contraire du code de César


text = input("entrez le message codé en minuscule: ")
liste=[]
i=0
texta="a"
# compte le nombre de caractère
longueur = len(text)
# conversion du texte en codes ascci
for i in range (longueur):
    a=ord(text[i:i+1])
    if a<97 or a>122:
        liste.append(chr(a))
    else:
        a=ord(text[i:i+1])-1
        if a>122 :
            a=97
            liste.append(chr(a-32))
        else:
            a=ord(text[i:i+1])-1
            liste.append(chr(a-32))
i=i+1
print ("message codé : "+''.join(liste))

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.