In a Python program i need to find the area of a circle can be determined by squ
ID: 3741829 • Letter: I
Question
In a Python program i need to find the area of a circle can be determined by squaring the circle’s radius and multiplying that by pior 3.14159.
area = radius * radius *
For this assignment, you will write a program that asks the user for the radius of two different circles. It should calculate the area of both circles. Finally, the program should display the area calculated for each circle and it should tell the user which circle has the greater area, or if the areas are the same (use if/else loop).
Name the program firstNameProgram2, where firstName is your first name. Your variables should allow the user to enter decimal values and they should be named: areaA, areaB, radiusA, radiusB and pie (we will avoid the use of key word pi).
Explanation / Answer
radiusA = int(input("Enter radius of the first circle:"))
radiusB = int(input("Enter radius of the second circle:"))
pie = 3.14159
areaA = radiusA * radiusA * pie
areaB = radiusB * radiusB * pie
if areaA == areaB:
print("Areas are same")
elif areaA > areaB:
print("The firs one has more area")
else:
print("The second one has more area")
'''SAMPLE OUTPUT
Enter radius of the first circle: 4
Enter radius of the second circle: 2
The firs one has more area
Enter radius of the first circle: 2
Enter radius of the second circle: 5
The second one has more area
Enter radius of the first circle: 5
Enter radius of the second circle: 5
Areas are same
'''
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.