나는 이렇게 학습한다/Algorithm & SQL

1022. Area of a Square

daco2020 2022. 10. 22. 16:50
반응형

Complete the function that calculates the area of the red square, when the length of the circular arc A is given as the input. Return the result rounded to two decimals.

image

Note: use the π value provided in your language (Math::PI, M_PI, math.pi, etc)



Solution:

def square_area(A):
    import math
    return round((A/math.pi*4/2)**2, 2)


반응형

'나는 이렇게 학습한다 > Algorithm & SQL' 카테고리의 다른 글

1024. Sum The Strings  (0) 2022.10.24
1023. No Loops 2 - You only need one  (0) 2022.10.23
1021. USD => CNY  (0) 2022.10.21
1020. Convert a string to an array  (0) 2022.10.20
1019. Is it a palindrome?  (0) 2022.10.19