Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- #
- # Script que pide al usuario que ingrese un paìs y su capital. Se debe
- # almacenar los datos en un diccionario y terminar la carga cuando se ingrese
- # como país la cadena "FIN". Luego, debe mostrar los datos en forma tabular
- miDiccionario = {}
- while True:
- pais = input("Ingrese un pais (o FIN para terminar): ")
- if pais == "FIN":
- break
- capital = input("Ingrese su capital: ")
- miDiccionario[pais] = capital
- print("Lista de países y capitales")
- for k,v in miDiccionario.items():
- print(k,v)
Advertisement
Add Comment
Please, Sign In to add comment