Question: Can someone edit my 2 lines of code?
Just wanted to point out that this is for a school assignment so I don't want to post all my code to prevent copy/plagiarism issues. Since I'm only having difficulties with a small requirement of the assignment, I don't think all my code is required anyways.
Requirement from the assgn I'm referring to:
Newx=ord(x)+3
Newx will be an integer. To find out what letter that integer represents you can use the chr function as in: actualLetter = chr(x) Write a function named cipher that takes a string and a key (integer). The function ciphers the string into another string and returns the new string. Note that when we reach 'z', and we want to add the key, we must 'roll' into the alphabet one more time, hence ord('z')+3 should give us ord('c').
When I run and test my program and input 'z', I don't get 'c', I get:
My code for this portion of the program that results in this issue is:
example_string = letters[((ord(i)+key)%97)%26]
example2_string += letters[((ord(i)-key)%97)%26]
(example_string and example2_string are fake names)