Advertisement
teslariu

geom

Jun 22nd, 2021
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.69 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. """
  4. Módulo que implementa el cálculo de perímetro y superficie de distintas
  5. figuras geométricas
  6. """
  7. from math import pi
  8.  
  9. def ingresar_numero():
  10.     while True:
  11.         try:
  12.             numero = float(input("Ingrese un número: "))
  13.         except ValueError:
  14.             print("No ha ingresado un número")
  15.         else:
  16.             return numero
  17.            
  18. def cuadrado(l):
  19.     return [l*4, l**2]
  20.    
  21. def rectangulo(l,L):
  22.     return [(l+L)*2, l*L]
  23.    
  24. def circulo(r):
  25.     return [2*pi*r, pi*r**2]
  26.  
  27. def imprimir(lista):
  28.     print(f"Perimetro: {lista[0]} - Superficie: {lista[1]}")
  29.    
  30. def mostrar_pi():
  31.     print(pi)
  32.    
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement