+ 1
Помогите исправить код
У меня уже жопа 5 день горит, я и так и сяк пробывал исправить код, но выходит одна и та же ошибка помогите плиз from math import pi radius = int(input()) p=0 a=0 def perim(p): p = 2*pi*radius def area(a): a = pi*radius**2 print("Perimeter:", round(perim(p), 2)) print("Area:",round(area(a), 2))
5 odpowiedzi
+ 6
Вы забыли ключевое слово return для возврата значений из функции.
(You forgot the return keyword to return values from a function.)
Я также меняю параметр, потому что параметр - это ваш радиус, а не результат.
(I also change the parameter because the parameter is your radius, not the result.)
р = 0
а = 0
Я также удалил эти два, потому что вам не нужно объявлять параметры вне функции.
(I also removed those two because you don't need to declare parameters outside of the function.)
(с помощью Google Translate)
Your Code:
https://code.sololearn.com/c7A18A1A15a2
+ 2
Майкл Дориан this might be you are trying to do
https://code.sololearn.com/ckvLcoy3aLG7/?ref=app
+ 1
What should the output looks like? Can you give sample inputs and outputs? Thanks
0
Thanks, everything works, but the task itself seems to have broken. Now everything is displayed correctly, but only the perimeter is displayed as the correct answer
0
from math import pi
radius = int(input())
def perim():
# место для вашего кода
return
def area():
# место для вашего кода
return
print("Perimeter:", round(perim(), 2))
print("Area:",round(area(), 2))
This is the source code
I understood why the assignments task Russian and English are different. In this case, as the correct answer, you need an answer from the assignment in English.
English task :
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
Sample Input
5
Sample Output
31.42
Russian task:
Here is a program that takes the radius of a circle as input. Complete the code to display the perimeter and area values of the circle.
Input example
5
Output example
Perimeter: 31.42
Area: 78.54
This is a bug