-
Notifications
You must be signed in to change notification settings - Fork 1
/
RegEx-Patterns-and-Intro-to-Databases.py
60 lines (45 loc) · 1.4 KB
/
RegEx-Patterns-and-Intro-to-Databases.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
"""
Task
Consider a database table, Emails, which has the attributes First Name and Email ID. Given rows of data simulating the Emails table, print an alphabetically-ordered list of people whose email address ends in .
Input Format
The first line contains an integer, , total number of rows in the table.
Each of the subsequent lines contains space-separated strings denoting a person's first name and email ID, respectively.
Constraints
Each of the first names consists of lower case letters only.
Each of the email IDs consists of lower case letters , and only.
The length of the first name is no longer than 20.
The length of the email ID is no longer than 50.
Output Format
Print an alphabetically-ordered list of first names for every user with a gmail account. Each name must be printed on a new line.
Sample Input
6
riya [email protected]
julia [email protected]
julia [email protected]
julia [email protected]
samantha [email protected]
tanya [email protected]
Sample Output
julia
julia
riya
samantha
tanya
"""
# SOLUTION
#!/bin/python3
import math
import os
import random
import re
import sys
if __name__ == '__main__':
names = []
N = int(input())
for N_itr in range(N):
firstNameEmailID = input().split()
firstName = firstNameEmailID[0]
emailID = firstNameEmailID[1]
if '@gmail.com' in emailID:
names.append(firstName)
print(*sorted(names), sep='\n')