Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- #
- # Ingresar numeros por pantalla y agregarlos a una lista. Cuando se
- # ingrese -1, se debe terminar el ingreso de datos e imprimir la lista
- # de nros
- #################### forma 1 (no recomendada)
- lista = []
- numero = int(input("Ingrese un número entero: "))
- while numero != -1:
- lista.append(numero)
- numero = int(input("Ingrese otro número entero: "))
- for numero in lista:
- print(numero, end="_")
- ################# forma recomendada
- lista = []
- while True:
- numero = int(input("Ingrese un número entero: "))
- if numero == -1:
- break
- lista.append(numero)
- for numero in lista:
- print(numero, end="_")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement