PopKhorn

Crypteur_Code_César

May 28th, 2020
650
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.57 KB | None | 0 0
  1. listeM = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
  2. listeM += listeM
  3. listem = 'abcdefghijklmnopqrstuvwxyz'
  4. listem += listem
  5. listex = ',;:!?./§%¨^*£$¤}=+°)]^ç\'_`|-[({"~&0123456789çéèàùûêôîâ'
  6. listex += listex
  7.  
  8. message = input('Entrez votre message : ')
  9. cle = int(input('Entrez votre clef : '))
  10. def chiffrage_lettre(lettre,listeM,listem,listex,cle):
  11. for i in range(len(listeM)):
  12. if listeM[i]==lettre:
  13. return str(listeM[i+cle])
  14. elif lettre==' ': #au cas ou il y a un espace
  15. return ' '
  16. for m in range (len(listem)):
  17. if listem[m]==lettre:
  18. return str(listem[m+cle])
  19. elif lettre==' ': #au cas ou il y a un espace
  20. return ' '
  21. for x in range (len(listex)):
  22. if listex[x]==lettre:
  23. if lettre=='é':
  24. return str(listem[4+cle])
  25. else:
  26. if lettre=='è':
  27. return str(listem[4+cle])
  28. else:
  29. if lettre=='ê':
  30. return str(listem[4+cle])
  31. else:
  32. if lettre=='à':
  33. return str(listem[0+cle])
  34. else:
  35. if lettre=='â':
  36. return str(listem[0+cle])
  37. else:
  38. if lettre=='ù':
  39. return str(listem[20+cle])
  40. else:
  41. if lettre=='û':
  42. return str(listem[20+cle])
  43. else:
  44. if lettre=='ô':
  45. return str(listem[14+cle])
  46. else:
  47. if lettre=='î':
  48. return str(listem[8+cle])
  49. else:
  50. if lettre=='ç':
  51. return str(listem[2+cle])
  52. else:
  53. return str(listex[x])
  54. elif lettre==' ': #au cas ou il y a un espace
  55. return ' '
  56.  
  57.  
  58. message_chiffre = str()
  59. for lettre in message:
  60. message_chiffre += chiffrage_lettre(lettre,listeM,listem,listex,cle)
  61. print(message_chiffre)
Advertisement
Add Comment
Please, Sign In to add comment