SHARE
TWEET

Untitled

a guest Oct 23rd, 2019 98 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env python3
  2. #switches
  3. switchOn=1
  4. menuChoice=0
  5. addKey="nome"
  6. addValue=0
  7. #dictionary
  8. agenda={}
  9.  
  10. #loop
  11. while switchOn!=0:
  12.  
  13.     #menu
  14.     print("MENU")
  15.     print("1-adicionar contato")
  16.     print("2-remover contato")
  17.     print("0-finalizar")
  18.    
  19.     #operation
  20.     menuChoice=(int(input("DIGITE UMA OPÇÃO :"))
  21.    
  22.     #add
  23.     if menuChoice==1:
  24.         addKey=input("nome :")
  25.         addValue=int(input("numero :"))
  26.         agenda[addKey]=addValue
  27.    
  28.     #remove
  29.     elif menuChoice==2:
  30.         addKey=input("remova @: ")
  31.         del agenda [addKey]
  32.    
  33.     #shutdown  
  34.     elif menuChoice==0:
  35.         switchOn=menuChoice
  36.    
  37.     else:
  38.         break
  39.            
  40.     #show
  41.     print(agenda)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top