Python 기본 사항쉬움

원의 면적 계산

'원의 면적 계산' 문제에 대한 자세한 안내 및 Python 구현입니다.

문제 설명

쉬움

음수가 아닌 숫자 radius을 사용하여 해당 반지름을 소수점 이하 2자리로 반올림한 원의 면적을 반환하는 함수 area_of_circle(radius)을 작성하세요.

다음 공식을 사용하세요: 면적 = π × 반경². π에는 math.pi 또는 3.14159265358979를 사용하세요.

제약
  • 0 <= radius <= 10^4

Example 1
Input
area_of_circle(5)
Output
78.54
Explanation

Area = π × 5² = π × 25 = 78.5398... ≈ 78.54.

Example 2
Input
area_of_circle(1)
Output
3.14
Explanation

Area = π × 1² = π ≈ 3.14.

Example 3
Input
area_of_circle(7)
Output
153.94
Explanation

Area = π × 7² = π × 49 = 153.938... ≈ 153.94.

Need a Hint?
세트나 힙과 같은 Numbers 관련 데이터 구조를 사용해 보세요.
Edge Cases to Watch
  • 빈 입력 구조
  • 단일 요소 입력
  • 큰 수치 범위

해결할 준비가 되셨나요?

Open the problem in PyRun's browser-based Python editor. Your code runs fully offline — no server required.

편집기에서 열기
Found this breakdown helpful?

PyRun is built and maintained by an independent solo developer. If this helped your interview prep, consider buying a coffee!

Buy me a coffee

권장 Python 리소스

관련 대화형 튜토리얼, 치트 시트, 코드 비교를 통해 지식을 확장하세요.