Advertisement
hackloper775

dic7

Feb 17th, 2013
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.63 KB | None | 0 0
  1. #!/usr/bin/env python3
  2.  
  3. distros = ["Gentoo","Ubuntu","Fedora","Pardus","Debian","Slackware"]
  4.  
  5. darwin = "iOS"
  6.  
  7. mi_dic = {}
  8.  
  9. ## Aqui lo llenamos:
  10.  
  11. mi_dic['Linux'] = distros
  12. mi_dic['Darwin'] = darwin
  13.  
  14. # Ya tiene llaves
  15.  
  16. for i in mi_dic["Linux"]:
  17.     print ("Una distro famosa de Linux es :", i)
  18.  
  19. # Llamos iOS
  20.  
  21. print ("\nDarwin se encuentra en :", mi_dic['Darwin'])
  22.  
  23. # Cambiamos el valor
  24.  
  25. mi_dic['Darwin'] = "MacOS X"
  26.  
  27. print ("Darwin se encuentra en :", mi_dic['Darwin'], "\n")
  28.  
  29.  
  30. for i in mi_dic:
  31.     print ("Llave: ",i)
  32.  
  33. print ("\nElimino Linux\n")
  34.  
  35. del mi_dic["Linux"]
  36.  
  37. for i in mi_dic:
  38.     print ("Llave: ",i)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement