-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path47.py
56 lines (41 loc) · 820 Bytes
/
47.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
#1
txt=open("postcard.txt", "r").read()
print(txt)
#2
txt=open("postcard.txt", "r").read()
h, b, t=tuple(txt.split('\n\n'))
print(b)
#3
txt=open("postcard.txt", "r").read()
h, b, t=tuple(txt.split('\n\n'))
import re
d=re.sub('[:,\.]', '', b)
print(d)
#4
txt=open("postcard.txt", "r").read()
h, b, t=tuple(txt.split('\n\n'))
import re
d=re.sub('[:,\.]', '', b)
d=d.upper()
print(d)
#5
txt=open("postcard.txt", "r").read()
h, b, t=tuple(txt.split('\n\n'))
import re
d=re.sub('[:,\.]', '', b)
d=d.upper()
password=[]
l = []
line = ""
for char in d:
if char == '\n':
l.append(line)
line = ""
else:
line += char
if line:
l.append(line)
for i in l:
password+=i.split()[:2]
message=' '.join(password)
print(message)