MCPcopy Create free account
hub / github.com/subbarayudu-j/TheAlgorithms-Python / main

Function main

ciphers/caesar_cipher.py:36–62  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

34
35
36def main():
37 while True:
38 print('-' * 10 + "\n**Menu**\n" + '-' * 10)
39 print("1.Encrpyt")
40 print("2.Decrypt")
41 print("3.BruteForce")
42 print("4.Quit")
43 choice = input("What would you like to do?: ")
44 if choice not in ['1', '2', '3', '4']:
45 print ("Invalid choice, please enter a valid choice")
46 elif choice == '1':
47 strng = input("Please enter the string to be encrypted: ")
48 key = int(input("Please enter off-set between 1-94: "))
49 if key in range(1, 95):
50 print (encrypt(strng.lower(), key))
51 elif choice == '2':
52 strng = input("Please enter the string to be decrypted: ")
53 key = int(input("Please enter off-set between 1-94: "))
54 if key in range(1,95):
55 print(decrypt(strng, key))
56 elif choice == '3':
57 strng = input("Please enter the string to be decrypted: ")
58 brute_force(strng)
59 main()
60 elif choice == '4':
61 print ("Goodbye.")
62 break
63main()

Callers 1

caesar_cipher.pyFile · 0.70

Calls 3

encryptFunction · 0.85
brute_forceFunction · 0.85
decryptFunction · 0.70

Tested by

no test coverage detected