Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can I please have a Python GUI with Tkinter for the Python program below print() print(Welcome to the Menu-driven Two Integer Rotation Cipher) print() #

Can I please have a Python GUI with Tkinter for the Python program below

print() print("Welcome to the Menu-driven Two Integer Rotation Cipher") print() # variable to store all the alphabets letters = 'abcdefghijklmnopqrstuvwxyz' while True: # printing the menu print("Choose one of the three options (1-3), shown below:") print("1. Encrypt a message") print("2. Decrypt a message") print("3. Quit") # getting the user choice choice = input("Enter your choice (1-3): ") # checking the input is digit or not if choice.isdigit(): # encrypting the message if choice == '1': text = input("Plaintext message: ") # getting the shift and checking for valid shift while True: shift = input("Enter size of rotation to use: ") if not shift.isdigit(): print('Invalid input. Rotation step should be an integer.') continue else: break # variable to store the encrypted text enc = '' # for every word in encrypted text for word in text.split(): # for every character in the word for c in word: # if character is in letters if c in letters: # finding the index of 'c' in letters i = letters.find(c) # adding the number of shifts from the index i = i + 2 + int(shift) # adds 2 to initial rotation = 3 if i > 25: i = i - len(letters) # finding the corresponding characters for the index in letters and stored in enc(encryption) enc += letters[i] else: enc += c enc += ' ' print("Ciphertext message: ", enc) elif choice == '2': # getting the cipher text text = input("Ciphertext message: ") # getting the shift and checking while True: shift = input("Enter size of rotation to use: ") # new integerrotation if not shift.isdigit(): print('Invalid input. Rotation step should be an integer.') continue else: break # variable to store the decrypted text dec = '' # for every word in decrypted text for word in text.split(): # for every character in the word for a in word: # changes the rotation integer # if character is in letters if a in letters: # finding the index of 'c' in letters i = letters.find(a) # subtracting the number of shifts from the index i = i - int(shift) if i < 0: i = i + len(letters) # finding the corresponding characters for the index in letters and stored in dec(decryption) dec += letters[i] else: dec += a dec += ' ' # prints the decrypted message print('Decrypted message: ', dec) # break from the loop elif choice == '3': print('Hope you like my Cryptography. Goodbye!') break # error in input else: print("Invalid input!! Valid options are: 1, 2 and 3! Try again!") continue

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Define the present value of an annuity due.

Answered: 1 week ago

Question

Determine miller indices of plane X z 2/3 90% a/3

Answered: 1 week ago