Advertisement
nein_yards

sorted by date

Dec 11th, 2020
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. import datetime
  2. customer_feedbacks = []
  3. customer_feedback_dict = {
  4. 'id': 0,
  5. 'date': datetime.time(0, 0),
  6. 'ambience': 0,
  7. 'service': 0,
  8. 'food': 0,
  9. 'hygiene': 0
  10. }
  11. i = -1
  12. menu_exit = False
  13. # CREATING FOR LOOP TO TAKE INPUT FROM CUSTOMERS
  14. while not menu_exit:
  15. customer_feedbacks.append(dict(customer_feedback_dict))
  16. i += 1
  17. print('---------------------------------------------------------------------------------------------------')
  18. print("* Welcome to Cloud Akali! *")
  19. print("please follow the instructions below to complete the customer survey and rate out of 10! ")
  20. customer_feedbacks[i]['id'] = int(input("Enter bill no. (01-05) : "))
  21. customer_feedbacks[i]['date'] = datetime.datetime.strptime(
  22. input('Enter date of visit: '),
  23. '%d/%m/%Y'
  24. )
  25. customer_feedbacks[i]['ambience'] = int(input('How did you like the overall ambience of the restaurant? : '))
  26. customer_feedbacks[i]['service'] = int(input("How would you rate our service? : "))
  27. customer_feedbacks[i]['food'] = int(input("What did you think about our food? : "))
  28. customer_feedbacks[i]['hygiene'] = int(input('Did our restaurant meet your standard of cleanliness and hygiene? : '))
  29. menu_exit = input('Question 4/4, type "yes" to proceed: ').lower() != 'yes'
  30. print('---------------------------------------------------------------------------------------------------')
  31.  
  32. customer_feedbacks = sorted(customer_feedbacks, key= lambda i: i['date'])
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement