Advertisement
pacho_the_python

enigma_3

Apr 12th, 2022
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.37 KB | None | 0 0
  1. rotor_1 = "EKMFLGDQVZNTOWYHXUSPAIBRCJ"
  2. rotor_2 = "AJDKSIRUXBLHWTMCQGZNPYFVOE"
  3. rotor_3 = "BDFHJLCPRTXVZNYEIWGAKMUSQO"
  4. rotor_4 = "ESOVPZJAYQUIRHXLNFTGKDCMWB"
  5. rotor_5 = "VZBRGITYUPSDNHLXAWMJQOFECK"
  6. rotor_6 = "JPGVOUMFYQBENHZRDKASXLICTW"
  7. rotor_7 = "NZJHGRCXMYSWBOUFAIVLPEKQDT"
  8. rotor_8 = "FKQHTLXOCBJSPDZRAMEWNIUYGV"
  9.  
  10. rotor_dict = {}
  11. selected_rotors = []
  12.  
  13. for i in range(1, 3 + 1):
  14.     rotor_data = input("Enter a number from 1 to 8 inclusive: ")
  15.     rotor = ""
  16.     while True:
  17.         if rotor_data.isdigit() and 1 <= int(rotor_data) <= 8 and rotor_data not in selected_rotors:
  18.             rotor += rotor_data
  19.             break
  20.         else:
  21.             print("Invalid input")
  22.             rotor_data = input("Enter a number from 1 to 8 inclusive: ")
  23.  
  24.     start_data = input("Enter a number from 0 to 25 inclusive: ")
  25.     start = ""
  26.     while True:
  27.         if start_data.isdigit() and 0 <= int(start_data) <= 25:
  28.             start += start_data
  29.             break
  30.         else:
  31.             print("Invalid input")
  32.             start_data = input("Enter a number from 0 to 25 inclusive: ")
  33.  
  34.     if int(rotor) == 1:
  35.         rotor_1 = rotor_1[int(start):] + rotor_1[:int(start)]
  36.         rotor_dict[i] = rotor_1
  37.         selected_rotors.append(rotor)
  38.     elif int(rotor) == 2:
  39.         rotor_2 = rotor_2[int(start):] + rotor_2[:int(start)]
  40.         rotor_dict[i] = rotor_2
  41.         selected_rotors.append(rotor)
  42.     elif int(rotor) == 3:
  43.         rotor_1 = rotor_3[int(start):] + rotor_3[:int(start)]
  44.         rotor_dict[i] = rotor_3
  45.         selected_rotors.append(rotor)
  46.     elif int(rotor) == 4:
  47.         rotor_1 = rotor_4[int(start):] + rotor_4[:int(start)]
  48.         rotor_dict[i] = rotor_4
  49.         selected_rotors.append(rotor)
  50.     elif int(rotor) == 5:
  51.         rotor_1 = rotor_5[int(start):] + rotor_5[:int(start)]
  52.         rotor_dict[i] = rotor_5
  53.         selected_rotors.append(rotor)
  54.     elif int(rotor) == 6:
  55.         rotor_1 = rotor_6[int(start):] + rotor_6[:int(start)]
  56.         rotor_dict[i] = rotor_6
  57.         selected_rotors.append(rotor)
  58.     elif int(rotor) == 7:
  59.         rotor_1 = rotor_7[int(start):] + rotor_7[:int(start)]
  60.         rotor_dict[i] = rotor_7
  61.         selected_rotors.append(rotor)
  62.     elif int(rotor) == 8:
  63.         rotor_1 = rotor_8[int(start):] + rotor_8[:int(start)]
  64.         rotor_dict[i] = rotor_8
  65.         selected_rotors.append(rotor)
  66.  
  67. print(rotor_dict)
  68.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement