Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- texte=input('Quel est le texte à coder ?')
- clef=int(input('Quelle est la clef ?'))
- caractères_accent=['é','è','ê','ë','à','â','ù','û','ô','ç','œ','æ']
- caractères_sans_accent=['e','e','e','e','a','a','u','u','o','c','oe','ae']
- ponctuation=[',',';',':','.','!','?','-','/']
- sans_ponctuation=[' ',' ',' ',' ',' ',' ',' ',' ']
- for i in range(12):
- texte=texte.replace(caractères_accent[i],caractères_sans_accent[i])
- for j in range(8):
- texte=texte.replace(ponctuation[j],sans_ponctuation[j])
- texte=texte.upper()
- #texte=texte.replace(' ','') # pour suppripmer les espaces
- print(texte)
- def César(texte,clef):
- texte_crypté=''
- for lettre in texte:
- if lettre==' ':
- texte_crypté=texte_crypté+' '
- else:
- rang=ord(lettre)-65
- rang_codé=(rang+clef)%26
- lettre_cryptée=chr(rang_codé+65)
- texte_crypté=texte_crypté+lettre_cryptée
- return texte_crypté
- print(César(texte,clef))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement