콘솔워크

배열 안에 str 형태로 들어있는 숫자의 합 본문

프로그래밍/python

배열 안에 str 형태로 들어있는 숫자의 합

이휘재123 2023. 5. 11. 17:08
반응형
num_list = ['1', '2', '3', '4', '5']
num_sum = sum(map(int, num_list))
print(num_sum)  # 출력 결과: 15

빠름

반응형