파이썬 math.fsum() 메서드
예시
모든 항목의 합계를 반환합니다.
# Import math Library
import math
# Print the sum of all items
print(math.fsum([1,
2, 3, 4, 5]))
print(math.fsum([100, 400, 340, 500]))
print(math.fsum([1.7,
0.3, 1.5, 4.5]))
정의 및 사용
이 math.fsum()
메서드는 반복 가능한 모든 항목(튜플, 배열, 목록 등)의 합계를 반환합니다.
통사론
math.fsum(iterable)
매개변수 값
Parameter | Description |
---|---|
iterable | Required. The list, tuple, array to sum. If the iterable is not numbers, it returns a TypeError |
기술적 세부 사항
반환 값: | float iterable에 있는 모든 항목의 합계를 나타내는 값 |
---|---|
파이썬 버전: | 2.6 |