area of a circle in python code example
Example 1: how to make circle in python
import turtle
def draw_circle(turtle,color,size,x,y):
turtle.penup()
turtle.color(color)
turtle.fillcolor(color)
turtle.goto(x,y)
turtle.pendown()
turtle.begin_fill()
turtle.circle(size)
turtle.end_fill()
square=turtle.Turtle()
square.speed(500)
draw_circle(square, "green", 50, 25, 0)
Example 2: area of a circle python
radius = float(input("Enter radius:"))
pi = 3.14
Area = pi * radius * radius
print("Area = " + str(Area))
Example 3: find the area of a circle in python
import math
radius = 3
area = math.pi * radius * radius
print(f'The area of the circle is {area:.3f}')
Example 4: area of a circle in python
R = int(input("Enter the radius of the circle: "))
PI = 22/7
A = PI * R * R
print(A)