-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathadieu.py
More file actions
41 lines (32 loc) · 749 Bytes
/
adieu.py
File metadata and controls
41 lines (32 loc) · 749 Bytes
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
import inflect
p = inflect.engine()
names = []
while True:
try:
name = input("Name: ")
except EOFError:
print()
break
else:
names.append(name)
print(f"Adieu, adieu, to {p.join(names)}")
"""
# code works but check50 is not accepting. In the hint it suggests to use inflect module with which it works.
names = []
while True:
try:
name = input("Name: ")
except EOFError:
print()
break
else:
names.append(name)
initial = "Adieu, adieu, to"
for i in range(len(names)):
if i == 0:
print(initial, names[i], end = "")
elif names[i] != names[-1]:
print(", " + names[i], end = "")
else:
print(" and " + names[i], end = "")
"""