forked from werhereitacademy/Python_Modul_Week_2
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathIsraa_Question_3.py
More file actions
76 lines (70 loc) · 2.54 KB
/
Israa_Question_3.py
File metadata and controls
76 lines (70 loc) · 2.54 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#Question 3
customers_information={}
def display_menu():
print('1. Add new customers')
print('2.Updating customer information')
print('3.Delete customer')
print('4.List all customers')
print('5.Check out')
def add_customer():
id=input('Enter unique customer ID: ')
name=input('enter customer name: ')
surname=input('Enter customer surname: ')
email=input('Enter customer e-mail: ')
phone_number=input('Enter customer phone number: ')
customers_information[id]={
'Name':name,
'Surname':surname,
'Email':email,
'Phone_number':phone_number
}
def updating_customer_information():
id=input('enter customer ID to update: ')
if id in customers_information:
name=input('Enter new name / leave blank to keep current: ')
surname=input('Enter customer surname / leave blank to keep current: ')
email=input('Enter customer e-mail / leave blank to keep current: ')
phone_number=input('Enter customer phone number / leave blank to keep current: ')
if name:
customers_information[id]['Name']=name
print('Update name is succesful! ')
if surname:
customers_information[id]['Surname']=surname
print('Update surname is succesful!')
if email:
customers_information[id]['Email']=email
print('Update email is succesful!')
if email:
customers_information[id]['Phone_number']=phone_number
print('Update phone number is succesful!')
else:
print(' Customer is not found ')
def delete_customer():
id = input ('Enter ID customer to delete: ')
if id in customers_information:
del customers_information[id]
print('delete customer is succesful! ')
else:
print('customer is not found')
def list_all_customers():
if customers_information:
for id,info in customers_information.items():
print('ID: ',id ,'-','Info: ', info)
else:
print('no customers available')
while True:
display_menu()
choise=input('Enter your choise: ')
if choise=='1':
add_customer()
elif choise=='2':
updating_customer_information()
elif choise=='3':
delete_customer()
elif choise=='4':
list_all_customers()
elif choise=='5':
print('Exiting the system ')
break
else:
print('Invalid choise, Try again!')