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

(새 문서: ==개요== ;Python factorial() ;파이썬 factorial() <source lang='Python'> from math import factorial print( factorial(4) ) </source> <source lang='Python'> def factorial(x): r...)
 
잔글 (봇: 자동으로 텍스트 교체 (-source +syntaxhighlight))
 
3번째 줄: 3번째 줄:
;파이썬 factorial()
;파이썬 factorial()


<source lang='Python'>
<syntaxhighlight lang='Python'>
from math import factorial
from math import factorial
print( factorial(4) )
print( factorial(4) )
</source>
</syntaxhighlight>
<source lang='Python'>
<syntaxhighlight lang='Python'>
def factorial(x):
def factorial(x):
     result = 1
     result = 1
13번째 줄: 13번째 줄:
         result *= i
         result *= i
     return result
     return result
</source>
</syntaxhighlight>


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

2020년 11월 2일 (월) 02:32 기준 최신판

1 개요[ | ]

Python factorial()
파이썬 factorial()
from math import factorial
print( factorial(4) )
def factorial(x):
    result = 1
    for i in range(2,x+1):
        result *= i
    return result

2 같이 보기[ | ]

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