0
Sololearn don't accept my code
Python Core 37.3 Practice Circle Dimensions You are given a program that takes the radius of a circle as the input. Complete the code to calculate the circle's perimeter and output the result. Remember, the perimeter of a circle = 2*pi*radius from math import pi radius = int(input()) def perim(): return 2*pi*radius def area(): return pi*radius*radius print("Perimeter:", round(perim(), 2)) print("Area:", round(area(), 2)) What is wrong?
4 odpowiedzi
+ 4
Азат Азат
You just have to print perimeter value
Don't print area
Your code is right but there is a problem in that practice.
When I had solved this problem then we had to print Perimeter as well as Area but I think Sololearn have changed something in test cases and in problem statement too.
+ 3
This code is correct:
from math import pi
radius = int(input())
perimeter = 2 * pi * radius
print(round(perimeter, 2))
+ 2
Hi!
There is no error found in your program. You're saying that they asked you to calculate the circle's perimeter only but you calculated its area additionally. I think this can be your problem. I mean try to print only its perimeter value as output.
Here it is what I mentioned above
print(round(area(),2))
0
Because I am not a pro member, ı dont see whole question. as far as i can understand the question, this is my solution:
from math import pi
def circle (a):
print("perimeter : ", 2*pi*a)
print("area : ", pi*(a**2))
circle(int(input("enter radius of the circle: ")))