Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- #
- from math import pi, sqrt
- def leer_dato(dato):
- """Función que lee y devuelve un entero"""
- while True:
- try:
- valor = float(input(f"Por favor, ingrese {dato}: "))
- return valor
- except ValueError:
- print("Error: no ha ingresado un numero")
- def cuadrado(lado):
- return [lado**2, lado*4]
- def circulo(radio):
- return [pi*radio**2, 2*pi*radio]
- def triangulo(base, altura):
- return [base*altura/2, base + altura + sqrt(base**2+altura**2)]
- def imprimir(resultados):
- print("Superficie: {:.2f} - Perímetro: {:.2f}".format(resultados[0],resultados[1]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement