Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem: Fix the errors, Indent properly, run and submit the output def caesar_encrypt(realText, step): outText = [] cryptText = [] uppercase = ['A', 'B', 'C',

Problem:

Fix the errors, Indent properly, run and submit the output

def caesar_encrypt(realText, step):

outText = []

cryptText = []

uppercase = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']

lowercase = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']

for eachLetter in realText:

if eachLetter in uppercase:

index = uppercase.index(eachLetter)

crypting = (index + step) % 26

cryptText.append(crypting)

newLetter = uppercase[crypting]

outText.append(newLetter)

elif eachLetter in lowercase:

index = lowercase.index(eachLetter)

crypting = (index + step) % 26

cryptText.append(crypting)

newLetter = lowercase[crypting]

outText.append(newLetter)

return outText

code = caesar_encrypt('abc', 2)

print()

print(code)

print()

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Sams Teach Yourself Beginning Databases In 24 Hours

Authors: Ryan Stephens, Ron Plew

1st Edition

067232492X, 978-0672324925

More Books

Students also viewed these Databases questions

Question

4 Homework K Answered: 1 week ago

Answered: 1 week ago