Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import inflect
- adieu = "Adieu, adieu, to "
- camma = ", "
- and_word = " and "
- name = []
- while True:
- try:
- name.append(input('Name: ').capitalize())
- except EOFError:
- print('\nAdieu, adieu, to',inflect.engine().join(name))
- break
- '''
- if len(name) < 1:
- print("you should enter at least one name.")
- elif len(name) == 1:
- print(adieu + f"{name[0]}")
- elif len(name) >= 1:
- print(adieu, end="")
- for i in range(len(name)):
- if i < (len(name) - 2):
- print(name[i] + camma, end="")
- elif i == (len(name) - 2):
- print(name[i] + and_word, end="")
- else:
- print(name[i])
- '''
Advertisement
Comments
-
- https://www.reddit.com/r/cs50/comments/zd6474/adieu_cs50p_problem/
Add Comment
Please, Sign In to add comment
Advertisement