HackerRank Python - Validating and Parsing Email Addresses

Given n pairs of names and email addresses as input, print each name and email address pair having a valid email address on a new line.

  1. # Enter your code here. Read input from STDIN. Print output to STDOUT
  2. import re
  3. pattern = r'^<[A-Za-z](\w|-|\.|_)[email protected][A-Za-z]+\.[A-Za-z]{1,3}>$'
  4. for _ in range(int(input())):
  5. name, email = input().split(' ')
  6. if re.match(pattern, email):
  7. print(name, email)
Please click on the like button if it worked

Solution not working or have any suggestions? Please send an email to [email protected]

donate a cup of tea :)

Join Our Facebook Group

Share this solution


Codesadda.com is your home of programming solutions, tutorials, video tutorials and much more. Sign Up for our weekly newsletter to get update about new content.

Like us on Facebook | Connect with us on LinkedIn | Subscribe our Channel on Youtube