Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have attached my code here. I just want to encode the word by word, not the whole sentence. there two pictures I have attached

I have attached my code here. I just want to encode the word by word, not the whole sentence. there two pictures I have attached you can have ideas about what I'm saying from there.

#File : translate.py #date : 3/2/2021 #Aurthor : Dhruvil Patel #Purpose : Program to encrypt a sentence

def main():

print() print("Program to encrypt a sentence.") print("You will be asked to enter a sentence.") print("Written by Dhruvil Patel.") print()

text = input("Enter a sentence: ") print() print() print("Original sentence:",text) wordsB = "" #got help from Dr.koch from email for words in text.strip().split(): wordsB = words[:: -1].lower() + " " + wordsB print("Encoded version: ",wordsB)

main()

image text in transcribedimage text in transcribed

C I Have X C Get Hox PO4S X Python X M Sent MX M Inbox X S Launch X $ Launch x 5 Launch X Annoux variabl x G TRIBU X How d x + > C O File /Users/dhruvilpatel/Downloads/P045p21%20reverse%20letters%20(3).pdf * Tp # D P04Sp21 reverse letters.pages 1/1 160% + H + ! Here is the precise dialog required: Program to encrypt a sentence. You will be asked to enter a sentence. Written by John Koch. Enter a sentence: How now brown cow Original sentence: How now brown cow Encoded version: woh won nworb woc The program should be stored in translate.py. You may run turnin as many times as you want (only the last one is kept). This program is due at noon on Thursday, March 4, 2021. This program is worth 60 points. 24%D Thu Mar 4 8:37 PM Q IDLE File Edit Shell Debug Options Window Help translate.py - /Users/dhruvilpatel/Documents/cs125/projects/project 4/translate.py (3.9.11 #File i translate.py Ndate 3/2/2021 #Aurthor : Dhruvil Patel #Purpose : Program to encrynt a sentence der meint): print print("Program to encrypt a sentence.') print("You will be asked to enter a sentence.) print("Written by Dhuvil Patel.) print() text = input["Enter a sentence: ") print) print() print("Original sentence:", text) ("", ) words #got help from Dr.kach fram a . IDLE Shell 3.9.1 for words in taxt.stris().spl You will be asked to enter a sentence. wordsB - words!! -1).low Written by Dhruvil Patal. print("Encoded version"wu Enter a sentence: HI hello nain) Original sentence: HI hello Encoded version: ollen in = RESTART: /Users/dhruvilgatel/Dacunents/cs125/projects/project 4/translate.py = Progran to encrypt a sentence You will be asked to enter a sentence. Written by Dhruvil Patel. Enter a sentence: hello hi Original sentence: hallahi Traceback (most recent call last): File "/Users/dhuvilgatel/Documents/cs125/projects/project 4/translate.py", li ne 26, in module> main() File "/users/dhruvilpatel/Documents/cs125/projects/project 4/translate.py", li ne 21, in main for words in text.strip.split(): AttributeError: 'huiltin_function_of_nethod' object has no attributa 'split = RESTART: /Users/dhruvilpatel/Documents/cs125/projects/project 4/translate.py = Program to encrypt a santance. You will be asked to enter a sentence. Written by Dhruvil Patel. Enter a sente: ni halla Original sentence: hi halla Encoded version: allah in Ln: 95 Col: 4 Ln: 27 Col: 0

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

Students also viewed these Databases questions

Question

1. How is the newspaper help to our daily life?

Answered: 1 week ago

Question

1. Prepare a short profile of Mikhail Zoshchenko ?

Answered: 1 week ago

Question

What is psychology disorder?

Answered: 1 week ago