-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGreeter.py
44 lines (32 loc) · 1.17 KB
/
Greeter.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
import os
# Greeter is a terminal application that greets old friends warmly,
# and remembers new friends.
### FUNCTIONS ###
def display_title_bar():
# Clears the terminal screen, and displays a title bar.
os.system('clear')
print("\t**********************************************")
print("\t*** Greeter - Hello old and new friends! ***")
print("\t**********************************************")
def get_user_choice():
# Let users know what they can do.
print("\n[1] See a list of friends.")
print("[2] Tell me about someone new.")
print("[q] Quit.")
return raw_input("What would you like to do? ")
### MAIN PROGRAM ###
# Set up a loop where users can choose what they'd like to do.
choice = ''
display_title_bar()
while choice != 'q':
choice = get_user_choice()
# Respond to the user's choice.
display_title_bar()
if choice == '1':
print("\nHere are the people I know.\n")
elif choice == '2':
print("\nI can't wait to meet this person!\n")
elif choice == 'q':
print("\nThanks for playing. Bye.")
else:
print("\nI didn't understand that choice.\n")