Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- caesar = input("Enter sentence to cipher: ")
- shift = input ("Enter shift amount: ")
- 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"]
- def split(caesar):
- return list(caesar)
- print(split(caesar))
- length = len(list(caesar))
- x = 0
- pos = int(shift)
- while pos > 26:
- pos = pos - 26
- while x < length:
- if list(caesar)[x] == "a":
- x = x+1
- pos2 = 0
- pos3 = pos2 + pos
- while pos3 > 26:
- pos3 = pos3 - 26
- print (alph[pos3])
- elif list(caesar)[x] == "b":
- x = x+1
- pos2 = 1
- pos3 = pos2 + pos
- while pos3 > 26:
- pos3 = pos3 - 26
- print (alph[pos3])
- elif list(caesar)[x] == "c":
- x = x+1
- pos2 = 2
- pos3 = pos2 + pos
- while pos3 > 26:
- pos3 = pos3 - 26
- print (alph[pos3])
- elif list(caesar)[x] == "d":
- x = x+1
- pos2 = 3
- pos3 = pos2 + pos
- while pos3 > 26:
- pos3 = pos3 - 26
- print (alph[pos3])
- elif list(caesar)[x] == "e":
- x = x+1
- pos2 = 4
- pos3 = pos2 + pos
- while pos3 > 26:
- pos3 = pos3 - 26
- print (alph[pos3])
- elif list(caesar)[x] == "f":
- x = x+1
- pos2 = 5
- pos3 = pos2 + pos
- while pos3 > 26:
- pos3 = pos3 - 26
- print (alph[pos3])
- elif list(caesar)[x] == "g":
- x = x+1
- pos2 = 6
- pos3 = pos2 + pos
- while pos3 > 26:
- pos3 = pos3 - 26
- print (alph[pos3])
- elif list(caesar)[x] == "h":
- x = x+1
- pos2 = 7
- pos3 = pos2 + pos
- while pos3 > 26:
- pos3 = pos3 - 26
- print (alph[pos3])
- elif list(caesar)[x] == "i":
- x = x+1
- pos2 = 8
- pos3 = pos2 + pos
- while pos3 > 26:
- pos3 = pos3 - 26
- print (alph[pos3])
- elif list(caesar)[x] == "j":
- x = x+1
- pos2 = 9
- pos3 = pos2 + pos
- while pos3 > 26:
- pos3 = pos3 - 26
- print (alph[pos3])
- elif list(caesar)[x] == "k":
- x = x+1
- pos2 = 10
- pos3 = pos2 + pos
- while pos3 > 26:
- pos3 = pos3 - 26
- print (alph[pos3])
- elif list(caesar)[x] == "l":
- x = x+1
- pos2 = 11
- pos3 = pos2 + pos
- while pos3 > 26:
- pos3 = pos3 - 26
- print (alph[pos3])
- elif list(caesar)[x] == "m":
- x = x+1
- pos2 = 12
- pos3 = pos2 + pos
- while pos3 > 26:
- pos3 = pos3 - 26
- print (alph[pos3])
- elif list(caesar)[x] == "n":
- x = x+1
- pos2 = 13
- pos3 = pos2 + pos
- while pos3 > 26:
- pos3 = pos3 - 26
- print (alph[pos3])
- elif list(caesar)[x] == "o":
- x = x+1
- pos2 = 14
- pos3 = pos2 + pos
- while pos3 > 26:
- pos3 = pos3 - 26
- print (alph[pos3])
- elif list(caesar)[x] == "p":
- x = x+1
- pos2 = 15
- pos3 = pos2 + pos
- while pos3 > 26:
- pos3 = pos3 - 26
- print (alph[pos3])
- elif list(caesar)[x] == "q":
- x = x+1
- pos2 = 16
- pos3 = pos2 + pos
- while pos3 > 26:
- pos3 = pos3 - 26
- print (alph[pos3])
- elif list(caesar)[x] == "r":
- x = x+1
- pos2 = 17
- pos3 = pos2 + pos
- while pos3 > 26:
- pos3 = pos3 - 26
- print (alph[pos3])
- elif list(caesar)[x] == "s":
- x = x+1
- pos2 = 18
- pos3 = pos2 + pos
- while pos3 > 26:
- pos3 = pos3 - 26
- print (alph[pos3])
- elif list(caesar)[x] == "t":
- x = x+1
- pos2 = 19
- pos3 = pos2 + pos
- while pos3 > 26:
- pos3 = pos3 - 26
- print (alph[pos3])
- elif list(caesar)[x] == "u":
- x = x+1
- pos2 = 20
- pos3 = pos2 + pos
- while pos3 > 26:
- pos3 = pos3 - 26
- print (alph[pos3])
- elif list(caesar)[x] == "v":
- x = x+1
- pos2 = 21
- pos3 = pos2 + pos
- while pos3 > 26:
- pos3 = pos3 - 26
- print (alph[pos3])
- elif list(caesar)[x] == "w":
- x = x+1
- pos2 = 22
- pos3 = pos2 + pos
- while pos3 > 26:
- pos3 = pos3 - 26
- print (alph[pos3])
- elif list(caesar)[x] == "x":
- x = x+1
- pos2 = 23
- pos3 = pos2 + pos
- while pos3 > 26:
- pos3 = pos3 - 26
- print (alph[pos3])
- elif list(caesar)[x] == "y":
- x = x+1
- pos2 = 24
- pos3 = pos2 + pos
- while pos3 > 26:
- pos3 = pos3 - 26
- print (alph[pos3])
- elif list(caesar)[x] == "z":
- x = x+1
- pos2 = 25
- pos3 = pos2 + pos
- while pos3 > 26:
- pos3 = pos3 - 26
- print (alph[pos3])
- elif list(caesar)[x] == " ":
- x = x+1
- print (" ")
- else:
- print("Error")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement