Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python Regex Before next lesson, upload this lab to the learning hub at learn.bcit.ca in the Activities/Assignments/Lesson9Lab dropbox. A sample solution will be posted at

image text in transcribedPython Regex

Before next lesson, upload this lab to the learning hub at learn.bcit.ca in the Activities/Assignments/Lesson9Lab dropbox. A sample solution will be posted at the start of the next lesson, so late submissions are not accepted. Write a python script with the following four functions that use regular expressions created by you: Function name isValidBCLicense Plate Returns True if the parameter matches this pattern Six characters total: three letters then three digits, or three digits then three letters, or two letters, digit, space or hyphen, two digits, letter All letters are UPPERCASE Example matches: ABC123 123ABC AB1 230 AB1-23C isValidPython VariableName Between one and 32 characters total: all characters must be lowercase letters or underscores, but not more than one underscore in a row Example matches: first_name a_good_variable_name Username followed by @ followed by domain name followed by period followed by top-level- domain. isValidEmail Address HINT: break down the parameter as follows: Function name Returns True if the parameter matches this pattern def Username rules: letters (upper or lower case) and isValidEmailAddress(email): underscores (as long as _ is neither the first nor email_data = re.split('@', last character): between 1 and 256 characters email) total username = Domain name rules: letters (upper or lower case) email_data[0] between 1 and 32 characters total domain_data = Top-level-domain rules: letters (upper or lower re.split('[.]', email_data[1]) case) between 2 and 5 characters total. domain_name = domain_data[0] Example matches: top_level_domain = Jason_Harrison@bcit.ca domain_data[1] b@c.com isValid Human Height Number of feet, apostrophe, number of inches, double quotation mark. a The number of feet must be 2-8 inclusive. The number of inches must be 0-11 inclusive. The number of inches between 0 and 9 may have an optional leading zero (e.g. 5'08" or 5'8") The shortest height is 2'1" (not 2'0") and the tallest height is 8'11" Note: instead of double quotation marks for inches, you can accept the word "in" instead. Example matches: 2'01" 2'1" 5'09" 6'2in 4'10in 6'2" 8'11

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

Microsoft Visual Basic 2005 For Windows Mobile Web Office And Database Applications Comprehensive

Authors: Gary B. Shelly, Thomas J. Cashman, Corinne Hoisington

1st Edition

0619254823, 978-0619254827

More Books

Students also viewed these Databases questions