Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

code in python Part I: Validate Street Addresses (10 points) Write a function street.addresses(),which takes a single argument addresses, which is a list of strings.

image text in transcribedimage text in transcribedimage text in transcribedcode in python

Part I: Validate Street Addresses (10 points) Write a function street.addresses(),which takes a single argument addresses, which is a list of strings. The function analyzes each string, and, if the string's format matches the pattern of a valid street address as described below, the function appends the string's index in addresses into a returned list. A validly formatted address is defined by the following components, in the given order: 1. one or more digits 2. exactly one space 3. an uppercase letter, followed by any combination of uppercase letters, lowercase letters and spaces exactly one space 5. the word Street', 'Road' or ' Path', capitalized exactly as given 6. optionally, the following text: a. exactly one space b. the string 'Apt. ', capitalized exactly as given c. exactly one space d. exactly one uppercase letter Examples of validly formatted addresses are ' 58 Gnarled Oak Street' and '173 East Main Road Apt. Q' Suppose the following list were passed as addresses: '21 Main Street', '12 Main Drive', '5 Elm Apt. E,'6 Elm Path Apt. 5'] The function would return [0, 31 because only the first and last strings in this example match the pattern defined above

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

Intranet And Web Databases For Dummies

Authors: Paul Litwin

1st Edition

0764502212, 9780764502217

More Books

Students also viewed these Databases questions

Question

Have ground rules been established for the team?

Answered: 1 week ago

Question

=+ Why have these changes occurred?

Answered: 1 week ago

Question

=+90 percent of all oil refineries) into several smaller companies

Answered: 1 week ago