"파이썬 sum()"의 두 판 사이의 차이

잔글 (봇: 자동으로 텍스트 교체 (-<source +<syntaxhighlight , -</source> +</syntaxhighlight>))
 
3번째 줄: 3번째 줄:
;파이썬 sum()
;파이썬 sum()


<source lang='python' run>
<syntaxhighlight lang='python' run>
numbers = [1, 2, 3, 4]
numbers = [1, 2, 3, 4]
print( sum(numbers) )
print( sum(numbers) )
</source>
</syntaxhighlight>
<source lang='python' run>
<syntaxhighlight lang='python' run>
numbers = (1, 2, 3, 4, 5)
numbers = (1, 2, 3, 4, 5)
print( sum(numbers) )
print( sum(numbers) )
</source>
</syntaxhighlight>
<source lang='python' run>
<syntaxhighlight lang='python' run>
numbers = [1, 2, 3, 4]
numbers = [1, 2, 3, 4]
print( sum(numbers, 10) )
print( sum(numbers, 10) )
</source>
</syntaxhighlight>
<source lang='python' run>
<syntaxhighlight lang='python' run>
numbers = (1, 2, 3, 4, 5)
numbers = (1, 2, 3, 4, 5)
print( sum(numbers, 8) )
print( sum(numbers, 8) )
</source>
</syntaxhighlight>


==같이 보기==
==같이 보기==

2021년 4월 8일 (목) 02:45 기준 최신판

1 개요[ | ]

Python sum()
파이썬 sum()
numbers = [1, 2, 3, 4]
print( sum(numbers) )
numbers = (1, 2, 3, 4, 5)
print( sum(numbers) )
numbers = [1, 2, 3, 4]
print( sum(numbers, 10) )
numbers = (1, 2, 3, 4, 5)
print( sum(numbers, 8) )

2 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}