Python Day 28: RegEx, Patterns, and Intro to Databases

Consider a database table, Emails, which has the attributes First Name and Email ID. Given N rows of data simulating the Emails table, print an alphabetically-ordered list of people whose email address ends in

  1. #!/bin/python3
  2. import re
  3. if __name__ == '__main__':
  4. N = int(input())
  5. pattern = r"@gmail\.com$"
  6. regex = re.compile(pattern)
  7. firstNames = []
  8. for N_itr in range(N):
  9. firstNameEmailID = input().split()
  10. firstName = firstNameEmailID[0]
  11. emailID = firstNameEmailID[1]
  12. if
  13. firstNames.append(firstName)
  14. firstNames.sort()
  15. for name in firstNames:
  16. print(name)
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 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