Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- #
- # Script para calcular perimetro y superficie de diversas figuras
- # geométricas mediante un menu de opciones
- import math
- print("Programa que calcula áreas y perímetros")
- while True:
- print("""
- Menú de opciones
- ----------------
- 1. Cuadrado
- 2. Rectángulo
- 3. Círculo
- 4. Salir
- """)
- opcion = input("Ingrese su opción: ")
- if opcion == "1":
- lado = float(input("Ingrese el valor del lado: "))
- print(f"Area: {lado**2} - Perímetro: {4*lado}")
- elif opcion == "2":
- L = float(input("Ingrese el valor del lado mayor: "))
- l = float(input("Ingrese el valor del lado menor: "))
- print(f"Area: {L*l} - Perímetro: {2*(L+l)}")
- elif opcion == "3":
- radio = float(input("Ingrese el valor del radio: "))
- print(f"Area: {math.pi*radio**2} - Perímetro: {2*math.pi*radio}")
- elif opcion == "4":
- print("Gracias por utilizar este programa ....")
- break
- else:
- print(f"Opción {opcion} equivocada")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement