Guest User

Untitled

a guest
Sep 22nd, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. print("")
  2. print("****************PHONEBOOK******************")
  3. print("*******STORE YOUR NAMES AND CONTACTS*******")
  4. print("")
  5. print("*******MENU DRIVEN PROGRAM*************")
  6. print("1. Do you want to enter the entry")
  7. print("2. Search the phone number by name")
  8. print("3. Delete an entry")
  9. print("4. Display the phonebook")
  10. print("5. EXIT for the phonebook\n")
  11.  
  12. while(1):
  13.  
  14. print("\n")
  15. option = int(input("Type your another option "))
  16.  
  17. if option == 1:
  18. n = int(input("How many names do you want to store "))
  19. print(" ")
  20. print("Please enter the name and their numbers ")
  21. print(" ")
  22. dictionary = {}
  23. i = 0
  24. for i in range(n):
  25. name, *line = input().split()
  26. scores = list(map(int, line))
  27. dictionary[name] = scores
  28.  
  29. elif option == 4:
  30. print(dictionary)
  31.  
  32. elif option == 3:
  33. delete = input("Enter the element to be deleted ")
  34. del dictionary[delete]
  35.  
  36. elif option == 5:
  37. exit()
  38.  
  39. else:
  40. name = input("Enter the name to be searched ")
  41. print(dictionary.get('name'))
Add Comment
Please, Sign In to add comment