Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need lines 34-40 to run my message that has been encrypted by a new user input

ID: 3753245 • Letter: I

Question

I need lines 34-40 to run my message that has been encrypted by a new user inputed alphabet ex: "greenabcdfg..." I get weird output characters when I run the program which can be seen in the kernal.

6 Gauthor: chrissteers g answer = input ("would you like to Decrypt or Encrypt data? (e-Encode, d=Decode' 18 11 if answer. lower)"q 12 print( "See you again soon!) 13 while answer.lowe "q": q-Quit)"j if answer. lowere 15 16 17 18 19 28 21 keywordinput("Please enter a keyword: lower) valid letters"abcdefghijklnnopgrstuvwxyz" messageinput("Enter your message:.Lower() for char in message: if char in valid_letters: = new-str char Varlable explorer File explorer 23 24 25 26 27 28 29 30 31 32 for char in keyword: if char in valid_letters: if char not in key: Python console key char Console 1/A for char in valid letters: if char not in key: Python 3.6.5 IAnaconda, Inc. default, Mar 29 2018, 13:14:23 Type "copyright", "credits" or "license" for more infornation IPython 6.4.8-- An enhanced Interactive Python. Restarting kernel. keychar def encrypt) index valuesvalid_letters.index char) for char in new_strl return "". join(key lindexKey) for indexKey in index values) rotatedencryptt) 35 36 37 38 39 for char in rotated: ciph_num5*(ord(char1+8%26 In 1l: runlel /Users/chrissteers/CSE 231/proj03.py', wdirUsers/chrissteers/ ciph-chr(ciph_nun) ciph_txt ciph CSE 231') print ciph_txt) would you like to Decrypt or Encrypt data? (e-Encode, d Decode 41 42 elif answer. towerl) "d" alph"abcdefghijklmnopqrstuwxyz" keywordinput"Please enter a keyword: " messageinput"Enter your message: ") , q=Quite Please enter a keyword: msu Enter your nessage: hello 46 47 48 def encrypted) rotated.index [charl cípn_txt (key [(5 * key. index(Charl return .Join(ciph txt) + 8) 26] for char in rotated] Please enter a keyword: 50 51 final encrypted() print final) Python console History log

Explanation / Answer

The weird output is because of the ASCII value computed in line 36
which computes special characters for encryption when the program runs.
The code contains logic errors as they should encrypt/decrypt alphabetical ASCII values.
Since the problem statement for code is not provided, we cannot update the algorithm for encyprtion in lines 34-40.
Please update the question with problem statement for the code and also the algorithm used for encryption/decryption algorithm.