Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Python program that works as a text manipulation tool. The paragraph of text that it will manipulate is: Python is an excellent choice

Write a Python program that works as a text manipulation tool. The paragraph of text that it will manipulate is:
"Python is an excellent choice as a first programming language to learn for a multitude of reasons. Its simplicity and readability make it approachable for beginners, with a clean and concise syntax that minimizes the learning curve. Python's versatility is another key advantage, as it can be used in various domains, from web development and data analysis to scientific computing and artificial intelligence."
Perform the following tasks on this paragraph:
Split the paragraph into a list of words.
Print the number of words.
Print only the first and last word.
Turn the first word into lowercase and the last word into uppercase.
Print the first and last word again to check that your changes worked.
Put the words back together into a paragraph.
Find the first occurrence of the word Python. Write a comment explaining why the result is not 0.
Count how many times the word and appears in the paragraph.
Replace all occurrences of and with &.
Print the whole paragraph to check that all of the previous changes worked.
Split the paragraph into a list of sentences.
Hint: You can use the '.' as the delimiter but when you do that, it will delete the periods. You must go back in and use a for loop to add a period back to the end of each sentence except for the last one.
Print the number of sentences.
Print only the second sentence from the list.
Convert the first and last sentences to all uppercase and then print them.
Reverse the order of the sentences.
Join the sentences from step c back into a paragraph.
Print the final paragraph.
When your program runs, it should match the expected output below exactly. Go back in and put in labels and line breaks as needed.
If you get stuck on any part of this problem, read up on the following Python functions/methods: len(), lower(), upper(), join(), find(), count(), replace(), split(), and reverse()

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_2

Step: 3

blur-text-image_3

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

Understanding Oracle APEX 5 Application Development

Authors: Edward Sciore

2nd Edition

1484209893, 9781484209899

More Books

Students also viewed these Databases questions

Question

If money was no object, what would you do all day?

Answered: 1 week ago

Question

Tool (SIP): Go back and rework your school improvement plan so that

Answered: 1 week ago