-
Notifications
You must be signed in to change notification settings - Fork 0
/
start_chat.py
61 lines (50 loc) · 1.98 KB
/
start_chat.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
# import statements.
# from globals import current_status_message
from add_status import add_status
from add_friend import add_friend
from send_message import send_message
from read_message import read_message
from read_chats import read_chats
# start_chat() function definition.
def start_chat(name, age, rating, status):
from globals import current_status_message
# validating users details.
error_message = None
if not (age > 15 and age <= 50) :
# invalid age.
error_message = "Invalid age. Provide correct details."
print error_message
else:
welcome_message = "Authentication complete. Welcome\n " \
"Name : " + name + "\n" \
"Age: " + str(age) + "\n" \
"Rating: " + str(rating) + "\n" \
"Glad to have you "
print welcome_message
# displaying menu for user.
show_menu = True
while show_menu:
menu_choices = "What do you want to do? \n " \
"1. Add a status update \n " \
"2. Add a friend \n " \
"3. Send a secret message \n " \
"4. Read a secret message \n " \
"5. Read a chat from a user \n " \
"6. Close application \n "
result = int(raw_input(menu_choices))
#validating users input
if (result == 1):
current_status_message = add_status(current_status_message)
elif (result == 2):
number_of_friends = add_friend()
elif (result == 3):
send_message()
elif (result == 4):
read_message()
elif (result == 5):
read_chats()
elif(result == 6):
#close application
show_menu = False
else:
print "Wrong choices. Try again."