Sololearn don't accept my code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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?

8th Aug 2021, 8:07 AM
Азат Азат
Азат Азат - avatar
4 Answers
+ 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.
8th Aug 2021, 8:55 AM
A͢J
A͢J - avatar
+ 3
This code is correct: from math import pi radius = int(input()) perimeter = 2 * pi * radius print(round(perimeter, 2))
8th Aug 2021, 10:19 AM
Азат Азат
Азат Азат - avatar
+ 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))
8th Aug 2021, 8:53 AM
Python Learner
Python Learner - avatar
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: ")))
6th Sep 2021, 8:00 PM
Bekir
Bekir - avatar