Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- # TEMPLATE while True SIN MENU
- """
- # Realizar un script que convierta una distancia de metros a kms"
- while True:
- ###################
- distancia = float(input("Ingrese una distancia en metros: "))
- print(f"{distancia} mts equivalen a {distancia/1000} kms")
- ##################
- opcion = input("Presione cualquier tecla para continuar (o 1 para salir): ")
- if opcion == "1":
- print("Gracias por usar este script...")
- break
- """
- # Adaptamos el script de nros pares e impares para ejecutarlo todas
- # las veces que queramos
- while True:
- ##########################
- lista_numeros = []
- impar = 0
- par = 0
- n = int(input("\nIngrese Un numero entero positivo: "))
- while n:
- if n % 2:
- impar = impar + 1
- else:
- par = par + 1
- lista_numeros.append(n);
- n = int(input("Ingrese otro numero entero positivo: "))
- print(f"{lista_numeros}")
- print(f"Hay un total de {impar} numeros impares y un total de {par} numeros pares.")
- ##################################################
- opcion = input("Presione cualquier tecla para continuar (o 1 para salir): ")
- if opcion == "1":
- print("Gracias por usar este script...")
- break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement