Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

python regex A transcript would have the format Super Hero rides/flies a vehicle and will have the following conditions: A Super Hero's name can be

python regex

A transcript would have the format Super Hero rides/flies a vehicle and will have the following conditions:

A Super Hero's name can be one word, or two words. The word or words in a name must start with a captial letter.

The verb can be either "rides" or "flies"

If the vehicle has a Name (first letter is capitalized), it can be two words. If the vehicle does not have a name, it will be one word and contain all lowercase letters.

If the above conditions are both not met, there is no match. You will then return a tuple of strings (nohero, noname)

Ex)

The Wasp rides the wind, but Iron Man rides a Quinjet

Although there is the phrase Wasp rides it does not have "a" following the word "rides". Therefore, your program needs to keep looking for the correct pattern.

This pattern is found in Iron Man rides a Quinjet. The correct output of the problem2 would be ("Iron Man", Quinjet)

Captain America rides a Harley

you should return:

('Captain America','Harley')

If you pass in:

No one rides a Harley like Ghost Rider, athough Spider Man rides a Harley with some similar expertise

you should return:

('Spider Man', 'Harley')

This is because No one did not have a capitalized first letter in the word preceding "rides"

If you pass in:

Starlord flies many ships, but Rocket flies a Warbird Special much faster

you should return:

('Rocket', 'Warbird Special')

vehicle has a 2 word name - both Warbird and Special are capitalized

If you pass in:

Groot rides a spaceship

you should return:

('Groot', 'spaceship')

vehicle does not have a name - returned value is just one word and lowercase

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

More Books

Students also viewed these Databases questions

Question

a. What is the purpose of the team?

Answered: 1 week ago

Question

b. What are its goals and objectives?

Answered: 1 week ago