Question: I cant seem to figure out what is wrong with my code when it prints out I get the words all together for example: Enter
I cant seem to figure out what is wrong with my code when it prints out I get the words all together for example:
Enter message to be encrypted: Hello World
Enter shift amount :
Encrypted message: KhoorZruogg
And then when I do the opposite I get this and it doesnt even have the correct letters:
Enter message to be encrypted: KhoorZruogg
Enter shift amount :
Encrypted message: belloqorlddd
This is my current code:
def encodemsg shift:
newmsg
for ch in msg:
if A ch and ch Z:
newch chrordch ordA shift ordA
newmsg newmsg newch
elif a ch and ch z:
newch chrordch orda shift orda
newmsg newmsg newch
else:
newch ch
newmsg newch
return newmsg
msg inputEnter message to be encrypted:
shiftstr inputEnter shift amount :
shift intshiftstr
printEncrypted message: encodemsg shift
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
