Advertisement
Guest User

Untitled

a guest
Apr 5th, 2020
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.68 KB | None | 0 0
  1. import os
  2.  
  3. def print_menu():
  4.     print('1. Print Phone Number')
  5.     print('2. Add a Phone Number')
  6.     print('3. Remove a Phone Number')
  7.     print('4. Lookup a Phone Number')
  8.     print('5. Quit')
  9.  
  10. numbers = {}
  11. menu_choice = 0
  12.  
  13. while menu_choice != 5:
  14.     os.system("cls")
  15.     print_menu()
  16.     menu_choice = int(input("Type in a number (1-5): "))
  17.     if menu_choice == 1:
  18.         print("Telephone Numbers: ")
  19.         for contact in numbers:
  20.             print(f"Nama : {contact}\t Phone : {numbers[contact]}")
  21.         print()
  22.         input("ENTER to EXIT")
  23.  
  24.     elif menu_choice == 2:
  25.         print("Add Name and Number for Contact")
  26.         name = input("Name : ")
  27.         phone = input("Phone : ")
  28.         numbers[name] = phone
  29.         input("ENTER to EXIT")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement