Python Day 28 : RegEx, Patterns, and Intro to Databases| HackerRank 30 Days of Code Solutions


 Code:

#!/bin/python3

import re

if __name__ == '__main__':
    N = int(input().strip())
    
    pattern = r"@gmail\.com$"
    regex = re.compile(pattern)
    firstNames = []

    for N_itr in range(N):
        first_multiple_input = input().rstrip().split()

        firstName = first_multiple_input[0]

        emailID = first_multiple_input[1]
        
        if regex.search(emailID):
            firstNames.append(firstName)
            
    firstNames.sort()

    for name in firstNames:
        print(name)
AJ Blogs

Hello everyone, My name Arth and I like to write about what I learn. Follow My Website - https://sites.google.com/view/aj-blogs/home

Post a Comment

Previous Post Next Post
Best Programming Books

Facebook

AJ Facebook
Checkout Our Facebook Page
AJ Blogs
Checkout Our Instagram Page