Advertisement
teslariu

func 3

Dec 9th, 2021
989
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.56 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. """
  5. Programa que pide el radio de un círculo (nro entero) y devuelve su
  6. su area y su perimetro
  7. """
  8. def area(r):
  9.     return 3.1416 * r**2
  10.    
  11. def perimetro(r):
  12.     return 2 * 3.1416 * r
  13.  
  14. def ingresar_radio():
  15.     while True:
  16.         radio = input("Ingrese el radio del círculo: ")
  17.         if radio.isdecimal():
  18.             return int(radio)
  19.         else:
  20.             print("Debe ingresar un entero positivo. Inténtelo nuevamente")
  21.  
  22.  
  23. radio = ingresar_radio()
  24. sup = area(radio)
  25. perim = perimetro(radio)
  26. print(f"Area: {sup} - Perímetro: {perim}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement