Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- """
- condicional: if <-----
- 2 bucles: 1 definido (for)
- 1 indefinido (while)
- # Hacer un script que pida una edad y responda si es mayor o no
- edad = int(input("Ingrese su edad: "))
- if edad >= 18:
- print("Usted es mayor de edad")
- print("Felicitaciones")
- else:
- print("Aun es menor de edad")
- print("Que lastima...")
- print("Chau")
- """
- # Hacer un script que pida una temperatura en ºC y la pase a ºF o viceversa
- # 10ºC = 50ºF
- print("Menú de opciones")
- print("----------------")
- print("1. ºC -> ºF")
- print("2. ºF -> ºC")
- opcion = input("Seleccione una opción: ")
- if opcion == "1":
- t = float(input("Ingrese la temperatura: "))
- print(f"{t}ºC equivalen a {t*1.8 + 32}ºF")
- else:
- t = float(input("Ingrese la temperatura: "))
- print(f"{t}ºF equivalen a {(t - 32) / 1.8}ºC")
Advertisement
Add Comment
Please, Sign In to add comment