Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- #
- """
- Programa que pide el radio de un círculo (nro entero) y devuelve su
- su area y su perimetro
- """
- def area(r):
- return 3.1416 * r**2
- def perimetro(r):
- return 2 * 3.1416 * r
- def ingresar_radio():
- while True:
- radio = input("Ingrese el radio del círculo: ")
- if radio.isdecimal():
- return int(radio)
- else:
- print("Debe ingresar un entero positivo. Inténtelo nuevamente")
- radio = ingresar_radio()
- sup = area(radio)
- perim = perimetro(radio)
- print(f"Area: {sup} - Perímetro: {perim}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement