Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can anyone help me with these assignments please I've been trying to figure them out but I just can't. It's python programming which is something

Can anyone help me with these assignments please I've been trying to figure them out but I just can't. It's python programming which is something im new to. The question are Write a script that inputs a line of plaintext and a distance value and outputs an encrypted text using a Caesar cipher. The script should work for any printable characters. And Write a script that inputs a line of encrypted text and a distance value and outputs plaintext using a Caesar cipher. The script should work for any printable characters.Both of these assignments are due very soon so please respond as soon as possible. image text in transcribedimage text in transcribed

Strings and Text Files (Exercise 1) Dus on Apr 29 a:11 PM PD encrypt.py 1| #Inport string 2inport string Test Results 013 passcd Test Case Strings and Text Fles Write a script that inputs a line of plaintext and a distance value and outputs an encrypted text using a Caesar cipher. The script should work for any printable characters. 4# define caesar function FAILED: Encryption I 5 def caesar (plainText, distance) distance %-26 INPUT 71 #Encrypting logic 8 | ?0w-string, asc11-lowercase 91 up=strtng. asc11-uppercase 10 11 sf up-up[distance: J+upt:distance] 2alpha-low+up 13 14 CLpherText-str.maketrans(alpha, sf_al) 15 16 17 18 19 ##Prop text from the user 20 platnText-input Enter a text to encrypt:" 21 22 #Prop distance from the user 23 distance-int(nput( Enter a distance value:")) 24 abcde 128 sf low low[dtstance:1+1 +low:distance] OUTPUT sf al-sf_low+sf_up Enter a text to encrypt:abcde Enter a distance value: 128 Encrypted text: yzabc eturn the encrypted value return plainText.translate(cipherText) RESULTS Show Details FAILED: EncrvntionI Run Code Test Grade

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

Database Design For Mere Mortals

Authors: Michael J Hernandez

4th Edition

978-0136788041

More Books

Students also viewed these Databases questions