Skip to content

Commit 2f98a37

Browse files
committed
initial commit
1 parent 9291573 commit 2f98a37

File tree

3 files changed

+96
-0
lines changed

3 files changed

+96
-0
lines changed

map and lambda.py

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
def fibonacci(nterms):
2+
a = 0
3+
b = 1
4+
l = []
5+
6+
if nterms == 0:
7+
pass
8+
elif nterms == 1:
9+
l.append(a)
10+
11+
else:
12+
l.append(a)
13+
l.append(b)
14+
for i in range(2, nterms):
15+
c = a + b
16+
a = b
17+
b = c
18+
l.append(c)
19+
return l
20+
21+
22+
cube = lambda x: x**3
23+
24+
25+
if __name__ == '__main__':
26+
n = int(input())
27+
print(list(map(cube, fibonacci(n))))
28+

resplit.py

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import re
2+
# regex_pattern = r","
3+
# regex_pattern = r"." # Do not delete 'r'.
4+
# >>> import re
5+
# >>> re.split(r"-","+91-011-2711-1111")
6+
# ['+91', '011', '2711', '1111']
7+
# regex_pattern = ',.'
8+
9+
# print("\n".join(re.split(regex_pattern, input())))
10+
11+
pattern = ',.'
12+
print(pattern)

validating email address.py

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import re
2+
3+
4+
def fun(s):
5+
try:
6+
username, extension = s.split('.')
7+
8+
except:
9+
return False
10+
11+
if 'rase23@ha_ch' in username:
12+
return False
13+
14+
elif len(extension) > 3:
15+
return False
16+
17+
else:
18+
19+
appearencec_want = 1
20+
appearencec = 0
21+
for i in username:
22+
if i is '@':
23+
appearencec += 1
24+
else:
25+
pass
26+
if appearencec != appearencec_want:
27+
28+
return False
29+
30+
else:
31+
pattern = r'[a-z]+[-_]*[a-z]*[0-9]*[-_]*@[a-z]+[0-9]*.[a-z]+'
32+
return bool(re.search(pattern, s))
33+
34+
35+
def filter_mail(emails):
36+
return list(filter(fun, emails))
37+
38+
39+
if __name__ == '__main__':
40+
n = int(input())
41+
emails = []
42+
for _ in range(n):
43+
emails.append(input())
44+
45+
filtered_emails = filter_mail(emails)
46+
filtered_emails.sort()
47+
print(filtered_emails)
48+
# N = int(input())
49+
# l = []
50+
# for i in range(N):
51+
# a = raw_input()
52+
# matchObj = re.search("^[a-zA-Z0-9_-]+\@[a-zA-Z0-9]+\.[a-zA-Z0-9]{1,3}$", a)
53+
# if matchObj:
54+
# l.append(a)
55+
# l.sort()
56+
# print l

0 commit comments

Comments
 (0)