Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.08 KB | None | 0 0
  1. caesar = input("Enter sentence to cipher: ")
  2. shift = input ("Enter shift amount: ")
  3. alph = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]
  4. def split(caesar):
  5. return list(caesar)
  6. print(split(caesar))
  7. length = len(list(caesar))
  8. x = 0
  9. pos = int(shift)
  10. while pos > 26:
  11. pos = pos - 26
  12. while x < length:
  13. if list(caesar)[x] == "a":
  14. x = x+1
  15. pos2 = 0
  16. pos3 = pos2 + pos
  17. while pos3 > 26:
  18. pos3 = pos3 - 26
  19. print (alph[pos3])
  20. elif list(caesar)[x] == "b":
  21. x = x+1
  22. pos2 = 1
  23. pos3 = pos2 + pos
  24. while pos3 > 26:
  25. pos3 = pos3 - 26
  26. print (alph[pos3])
  27. elif list(caesar)[x] == "c":
  28. x = x+1
  29. pos2 = 2
  30. pos3 = pos2 + pos
  31. while pos3 > 26:
  32. pos3 = pos3 - 26
  33. print (alph[pos3])
  34. elif list(caesar)[x] == "d":
  35. x = x+1
  36. pos2 = 3
  37. pos3 = pos2 + pos
  38. while pos3 > 26:
  39. pos3 = pos3 - 26
  40. print (alph[pos3])
  41. elif list(caesar)[x] == "e":
  42. x = x+1
  43. pos2 = 4
  44. pos3 = pos2 + pos
  45. while pos3 > 26:
  46. pos3 = pos3 - 26
  47. print (alph[pos3])
  48. elif list(caesar)[x] == "f":
  49. x = x+1
  50. pos2 = 5
  51. pos3 = pos2 + pos
  52. while pos3 > 26:
  53. pos3 = pos3 - 26
  54. print (alph[pos3])
  55. elif list(caesar)[x] == "g":
  56. x = x+1
  57. pos2 = 6
  58. pos3 = pos2 + pos
  59. while pos3 > 26:
  60. pos3 = pos3 - 26
  61. print (alph[pos3])
  62. elif list(caesar)[x] == "h":
  63. x = x+1
  64. pos2 = 7
  65. pos3 = pos2 + pos
  66. while pos3 > 26:
  67. pos3 = pos3 - 26
  68. print (alph[pos3])
  69. elif list(caesar)[x] == "i":
  70. x = x+1
  71. pos2 = 8
  72. pos3 = pos2 + pos
  73. while pos3 > 26:
  74. pos3 = pos3 - 26
  75. print (alph[pos3])
  76. elif list(caesar)[x] == "j":
  77. x = x+1
  78. pos2 = 9
  79. pos3 = pos2 + pos
  80. while pos3 > 26:
  81. pos3 = pos3 - 26
  82. print (alph[pos3])
  83. elif list(caesar)[x] == "k":
  84. x = x+1
  85. pos2 = 10
  86. pos3 = pos2 + pos
  87. while pos3 > 26:
  88. pos3 = pos3 - 26
  89. print (alph[pos3])
  90. elif list(caesar)[x] == "l":
  91. x = x+1
  92. pos2 = 11
  93. pos3 = pos2 + pos
  94. while pos3 > 26:
  95. pos3 = pos3 - 26
  96. print (alph[pos3])
  97. elif list(caesar)[x] == "m":
  98. x = x+1
  99. pos2 = 12
  100. pos3 = pos2 + pos
  101. while pos3 > 26:
  102. pos3 = pos3 - 26
  103. print (alph[pos3])
  104. elif list(caesar)[x] == "n":
  105. x = x+1
  106. pos2 = 13
  107. pos3 = pos2 + pos
  108. while pos3 > 26:
  109. pos3 = pos3 - 26
  110. print (alph[pos3])
  111. elif list(caesar)[x] == "o":
  112. x = x+1
  113. pos2 = 14
  114. pos3 = pos2 + pos
  115. while pos3 > 26:
  116. pos3 = pos3 - 26
  117. print (alph[pos3])
  118. elif list(caesar)[x] == "p":
  119. x = x+1
  120. pos2 = 15
  121. pos3 = pos2 + pos
  122. while pos3 > 26:
  123. pos3 = pos3 - 26
  124. print (alph[pos3])
  125. elif list(caesar)[x] == "q":
  126. x = x+1
  127. pos2 = 16
  128. pos3 = pos2 + pos
  129. while pos3 > 26:
  130. pos3 = pos3 - 26
  131. print (alph[pos3])
  132. elif list(caesar)[x] == "r":
  133. x = x+1
  134. pos2 = 17
  135. pos3 = pos2 + pos
  136. while pos3 > 26:
  137. pos3 = pos3 - 26
  138. print (alph[pos3])
  139. elif list(caesar)[x] == "s":
  140. x = x+1
  141. pos2 = 18
  142. pos3 = pos2 + pos
  143. while pos3 > 26:
  144. pos3 = pos3 - 26
  145. print (alph[pos3])
  146. elif list(caesar)[x] == "t":
  147. x = x+1
  148. pos2 = 19
  149. pos3 = pos2 + pos
  150. while pos3 > 26:
  151. pos3 = pos3 - 26
  152. print (alph[pos3])
  153. elif list(caesar)[x] == "u":
  154. x = x+1
  155. pos2 = 20
  156. pos3 = pos2 + pos
  157. while pos3 > 26:
  158. pos3 = pos3 - 26
  159. print (alph[pos3])
  160. elif list(caesar)[x] == "v":
  161. x = x+1
  162. pos2 = 21
  163. pos3 = pos2 + pos
  164. while pos3 > 26:
  165. pos3 = pos3 - 26
  166. print (alph[pos3])
  167. elif list(caesar)[x] == "w":
  168. x = x+1
  169. pos2 = 22
  170. pos3 = pos2 + pos
  171. while pos3 > 26:
  172. pos3 = pos3 - 26
  173. print (alph[pos3])
  174. elif list(caesar)[x] == "x":
  175. x = x+1
  176. pos2 = 23
  177. pos3 = pos2 + pos
  178. while pos3 > 26:
  179. pos3 = pos3 - 26
  180. print (alph[pos3])
  181. elif list(caesar)[x] == "y":
  182. x = x+1
  183. pos2 = 24
  184. pos3 = pos2 + pos
  185. while pos3 > 26:
  186. pos3 = pos3 - 26
  187. print (alph[pos3])
  188. elif list(caesar)[x] == "z":
  189. x = x+1
  190. pos2 = 25
  191. pos3 = pos2 + pos
  192. while pos3 > 26:
  193. pos3 = pos3 - 26
  194. print (alph[pos3])
  195. elif list(caesar)[x] == " ":
  196. x = x+1
  197. print (" ")
  198. else:
  199. print("Error")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement