Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This assignment will use methods and functions to show how Python can locate and extract sub-strings from a string. Use the phrase The quick brown

This assignment will use methods and functions to show how Python can locate and extract sub-strings from a string. Use the phrase "The quick brown fox jumps over the lazy dog" and find the following: The first character position of the strings: "fox", "lazy" and "dog" use the .find method with the spaces to find your place in the word. e.g. position1 = phrase.find(" ") will return 3, because the first space in the string is in position 3 of the string. Display the strings and the starting positions. e.g. print ("In", phrase, "the word fox begins in position", position1) Find the following words by assigning the slice to a variable: "fox", "jumps" and "quick" e.g word1 = phrase[0:3] will assign "the" to the variable word1. Display the length of each string. print the string "I have found the words," ,and concatenate the words with the proper punctuation (e.g. word1+"," etc...)

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

Programming The Perl DBI Database Programming With Perl

Authors: Tim Bunce, Alligator Descartes

1st Edition

1565926994, 978-1565926998

More Books

Students also viewed these Databases questions

Question

LO2 Identify components of workflow analysis.

Answered: 1 week ago