Session Ready
Exercise

Give me your email

A colleague has asked for your help! When a user signs up on the company website, they must provide a valid email address.
The company puts some rules in place to verify that the given email address is valid:

  • The first part can contain:
    • Upper A-Z and lowercase letters a-z
    • Numbers
    • Characters: !, #, %, &, *, $, .
  • Must have @
  • Domain:
    • Can contain any word characters
    • But only .com ending is allowed

The project consist of writing a script that checks if the email address follow the correct pattern. Your colleague gave you a list of email addresses as examples to test.

The list emails as well as the re module are loaded in your session. You can use print(emails) to view the emails in the IPython Shell.

Instructions
100 XP
  • Write a regular expression to match valid email addresses as described.
  • Match the regex to the elements contained in emails.
  • To print out the message indicating if it is a valid email or not, complete .format() statement.