Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is using python original is like this Weather the whether be fine, Or weather the whether be not. Weather the whether be cold, Or

image text in transcribed

This is using python

original is like this

Weather the whether be fine, Or weather the whether be not. Weather the whether be cold, Or weather the whether be hot. We'll whether the whether, Whatever the whether, Weather we like it or not. 

so i want it print like this

Whether the weather be fine, Or whether the weather be not. Whether the weather be cold, Or whether the weather be hot. We'll weather the weather, Whatever the weather, Whether we like it or not. 

instead it print like this what is wrong i think i did it correctly

Whether the the be fine, Or whether the the be not. Weather the the be cold, Or whether the the be hot. We'll hot. We'll the whether, Whatever the whether, Weather we like it or not.

f1 = open("weather.txt', 'r')#this will not load t t2 = open(newtext.txt','w') data = f1.read()#now we have read all the text in newtext "" swap "" textin = data, split(' ') for word in textin: if word == "weather": elif word =- "Weather". elif word == "whether". elif word"Whether": else: swap word . replace("weather", "whether") = swap word. replace("Weather", "Whether") = word.replace( "whether", "weather") word.replace("Whether", "Weather") swap word net ext += swap + print (swap) print (newtext)

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

Oracle RMAN For Absolute Beginners

Authors: Darl Kuhn

1st Edition

1484207637, 9781484207635

More Books

Students also viewed these Databases questions

Question

What is the foreign exchange market?

Answered: 1 week ago