Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- #
- # Segundo ejemplo de un template con menu
- print("Calculo de superficies y perimetros")
- while True:
- print("\nMenu de opciones")
- print("1. Cuadrado")
- print("2. Círculo")
- print("3. Rectángulo")
- print("4. Salir")
- opcion = input("Seleccione una opción: ")
- if opcion == "1":
- l = float(input("Ingrese el lado: "))
- print(f"Superficie: {l**2}")
- print(f"Perímetro: {4*l}")
- elif opcion == "2":
- r = float(input("Ingrese el radio: "))
- print(f"Superficie: {3.1416 * r**2}")
- print(f"Perímetro: {2 * 3.1416 * r}")
- elif opcion == "3":
- l = float(input("Ingrese el lado menor: "))
- L = float(input("Ingrese el lado mayor: "))
- print(f"Superficie: {l*L}")
- print(f"Perímetro: {2*(l+L)}")
- elif opcion == "4":
- print("Gracias por usar este programa...")
- break
- else:
- print("Opción incorrecta...")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement