Question: Code on Python returns Syntax error: EOL while scanning string literal at code in bold below: # function to encode plaintext using Caesar # shift

Code on Python returns Syntax error: "EOL while scanning string literal" at code in bold below:

# function to encode plaintext using Caesar

# shift cipher

def encodePlaintext (plaintext, shiftKey):

ciphertext = ""

shiftNumber = ord(shiftKey) - ord('A')

for plainLetter in plaintext:

index = ((ord(plainLetter) - ord('A')

+ shiftNumber) % 26)

cipherLetter = chr(ord('A') + index)

ciphertext = ciphertext + cipherLetter

return ciphertext

def main():

key = raw_input ('Enter a shift key in uppercase: ')

message = raw_input('Enter a word in uppercase \

to encrypt (# to quit): ')

while message != '#':

secret = encodePlaintext(message, key)

print 'The encrypted word is:', secret

message = raw_input('Enter a word in uppercase \

to encrypt (# to quit): ')

print 'All done'

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!