teslariu

modulo cuadrado

Feb 9th, 2022
572
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.48 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3.  
  4. # bibliotecas (library) ---> abuso: librería
  5. # una biblioteca es un comjunto de módulos funcionales
  6. # un módulo funcional es un archivo .py con funciones
  7.  
  8.  
  9. # la biblioteca std de Python tiene muchos módulos incorporados, entre ellos,
  10. # el módulo math
  11.  
  12. # Voy a crear un módulo cuadrado
  13. import math
  14.  
  15. def area(lado):
  16.     return lado**2
  17.    
  18. def perimetro(lado):
  19.     return 4*lado
  20.    
  21. def diagonal(lado):
  22.     return math.sqrt(2 * lado**2)
Advertisement
Add Comment
Please, Sign In to add comment