Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using python Write a function that matches a string that has an 'D' followed by zero or more a's def probleml_a (string): Function that matches

Using pythonimage text in transcribedimage text in transcribed

Write a function that matches a string that has an 'D' followed by zero or more a's def probleml_a (string): Function that matches a string containing a 'D' with zero or more 'a's after it >>probleml_a("I cook for a hobby.") no match >>>probleml_a("I dabble in cooking.") no match >>probleml_a ("Dang, that's a good burger!" match found >>problem1_a("D is my favorite letter in the alphabet") match found >>probleml_a ("My favorite letter in the alphabet is D") match found YOUR CODE HERE # Question 1b. Write a function that matches a string that has a 't' followed by three 'o's def probleml_b (string) Function that matches a string containing a 't' and is followed by three 'o's >>probleml_b ("Are you going to the shops?" no match >>>probleml b("I like going to the shops too!") no match >>probleml_b ("I would go but it's tooo far.") match found >>> probleml _b("Train said 'totoooo-totoooo'") match found YOUR CODE HERE # Question 1c. Write a function that matches a word only at the beginning of a string def probleml_c (string) Function that matches a word only at the beginning of a string >>>probleml c("Hello world!") match found >>> problemi-c("VDSC20sthebest") no match >>probleml_c("") no match >>>probleml_c("word") match found >>probleml_c("wordl7") no match # YOUR CODE HERE # Question 1d Write a function that matches a word containing 't'. def probleml_d(string): Function that matches a word containing 't >>probleml _d("I would like to use regular expressions.") match found probleml_d("I like regular expressions." no match >>>probleml_d("abcdefghijklmnopgrsuvwxyz") no match # YOUR CODE HERE # Question 1e Write a function that matches a string that has an 'r' followed by at least on character and ending in 'z (In other words, it's trying to find any part of the string that has an r in it, and that r is followed by a z, as long as there is at least one character between the two) def probleml_e (string): Function that matches a string that has an 'r' followed by at least one character and ending in'z >>>probleml e("I love ritz crackers." match found probleml_e("I wrote a post on Piazza.") match found >>probleml_e ("That was a really good movie.") no match # YOUR CODE HERE # Question 1f Write a function that matches a word containing 'm' but isn't at the start or end of the word def probleml_f (string): Function that matches a word containing 'm' but isn't at the start or end of the worc >>>probleml f ("mickey mouse") no match >>probleml _f ("m" no match >>> probleml_f("mountain climbing") match found >>>probleml f ("Ooom, take me out of here") no match probleml_f("mummy is scary match found # YOUR CODE HERE #

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 And Expert Systems Applications Dexa 2022 Workshops 33rd International Conference Dexa 2022 Vienna Austria August 22 24 2022 In Computer And Information Science 33

Authors: Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil ,Bernhard Moser ,Alfred Taudes ,Atif Mashkoor ,Johannes Sametinger ,Jorge Martinez-Gil ,Florian Sobieczky ,Lukas Fischer ,Rudolf Ramler ,Maqbool Khan ,Gerald Czech

1st Edition

3031143426, 978-3031143427

More Books

Students also viewed these Databases questions

Question

3. Identify challenges to good listening and their remedies

Answered: 1 week ago

Question

4. Identify ethical factors in the listening process

Answered: 1 week ago