Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Lab3 due Feb 13th at 11:55 PM T CS 497 Introduction to Python Programming Instructions 0. Remember to comment. If your code fails to perform
Lab3 due Feb 13th at 11:55 PM T CS 497 Introduction to Python Programming Instructions 0. Remember to comment. If your code fails to perform the task at hand but your comments are describing proper code execution I can award a substanial amount of points for logical errors in your program. Think of comments as the equivalent of showing your work in a math class 1. Read all instructions carefully, ask questions if anything is confusing 2. Fill in the code/text blocks to answer each question. 3. Do not change any of the existing code provided. The code is specifically there to help you! 4. Run the entire notebook before submitting it on Sakai to make sure that the code actually runs without errors. 5. Important: Any question for which your code fails to run will receive O points 6 Have fun! 7. DO NOT USE ANY PACKAGES, other than the ones I have imported. Part of learning is to struggle through the "hard way" before getting to do things the easy way. Any packages I have imported are fair game and you may use any functions unless otherwise specified. If I've imported them after a function, I've deliberately made it so you cannot retroactively use them in an earlier problem. 8. If I've used return(None) for a function, you may definitely change the return type. It's just a placeholder 9. While you may discuss the concepts of the problems with your peers your code will need to be yours and yours alone 10. Replace CS497 with your BUID (ie if I was turning in this assignment my file would be called dbrennan_lab3). Problem 1 (60 points) In this problem we will be writing a function to assist with checking if something is a valid email A valid email can be defined for this problem as taking the format X@Y.Z where X is considered a user, Y is considered a domain and Z is considered the domain extension To make things interesting, X must contain more letters than numbers, Y may not contain more than two numbers, and Z cannot contain any numbers and must be of length 3 exactly X, Y, and Z will only contain numbers or letters no !@#$%"8T) etc Your function will return either True or False is_valid_email (johnSmith 123@abcCorp123.com) is False, Y contains 3 numbers is_valid_email (johnSmith 123@abcCorp123.coms) is False, Z contaisn 4 characters is_valid_email (12345John@abcCorp.com) is False, X contains more numbers than letters is_valid_email (123John@abcCorp.com) is True, X/YIZ checks ar In [6]: #To save time in the future, let's use these for ascii letters and numbers (you may use these for hw/tests) from string import ascii_lowercase from string import ascii_uppercase from string import digits print("ascii_lowercase is:",ascii_lowercase) print("ascii_uppercase is:",ascii uppercase) print("digits is:",digits) ascii_lowercase is: abcdefghijklmnopqrstuvwxyz ascii_uppercase is: ABCDEFGHIJKLMNOPORSTUVWXYZ digits is: 0123456789 In [] def is_valid_email(string): output = False #Your code below return(output)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started