Project Level 1: Beginner
This project is designed for beginner learners who are still learning and practicing Python fundamentals.
Project Description
Your task for today is to create a Python program that calculates the area of a circle.
How the Project Works
The program starts by prompting the user to submit the radius of the circle. Once the user submits a number (e.g., 22), the program displays a message that includes the area of the circle.
Note that the area is shown with two decimal points.
Prerequisites
Required Libraries: math (optional)
Required Files: No files are required.
IDE: You can use any IDE on your computer to code the project.
Danger Zone
Once you code the project, compare it with our solution below. There are two different solutions that differ in the way we round up numbers. The advantages and disadvantages of each solution are also explained:
r = int(input("ingrese un radio de la circunferencia: "))
area= 3.1416 * (r**2)
print(f"El area de una circulo de radio: {r} es {area}")
iimport math
r=float(input("Ingrese el radio del circulo: "))
area=math.pi*2*r
peri=math.pi*r*r
print(f"el area del circulo es de: {area}")
print(f"el perimetro del circulo es de: {peri}")