# Name
Name = raw_input("Enter Your Name: ")
# Give area for the circle
Area = input("Enter Area of the circle: ")
PI = 3.14
# Calculation of radius and circumference
R = (Area / PI )**0.5
C = (2 * PI * R)
print "Area of the Circle = %.2f"%Area
print "Radius of Circle = %.2f"%R
print "Circumference of Circle = %.2f"%C
def computeArea(val):
area=pi*(val**2)
return area
pi=3.14
inputText=input("does the question give a diameter(d) or radius(r)")
if inputText=='r':
radius=int(input("what is the radius"))
print(f"area of the circle is {computeArea(radius)}")
elif inputText=='d':
D=int(input("what is the diameter"))
r=(D/2)
area=computeArea(r)
print(f"area of the circle is {computeArea(r)}")
else:
print("You entered an incorrect value you can either type r for radius or d for diameter")
5条答案
按热度按时间f4t66c6m1#
表示计算平方根计算(√)。您只需要
来解决这个问题。
nxagd54h2#
用这个
希望能有所帮助。
sh7euo9m3#
不需要定义任何函数就可以计算圆的面积。
试试这个:
w6lpcovy4#
下面是求圆的半径和周长
ejk8hzay5#