카카오_해커랭크_medium_Extra Long Factorials_구현_수학

RostoryT·2022년 7월 14일
0
post-thumbnail

  • 그냥 팩토리얼 구하는 함수 짜기 - 매우 쉬운데 이게 왜 medium인지 모르겠음

솔루션 코드 - 실행용

def extraLongFactorials(n):
    ans = 1
    for i in range(1, n+1):
        ans *= i
    return ans

print(extraLongFactorials(25))

솔루션 코드 - 제출용

#!/bin/python3

import math
import os
import random
import re
import sys

#
# Complete the 'extraLongFactorials' function below.
#
# The function accepts INTEGER n as parameter.
#

def extraLongFactorials(n):
    ans = 1
    for i in range(1, n+1):
        ans *= i
    print(ans)

if __name__ == '__main__':
    n = int(input().strip())

    extraLongFactorials(n)

profile
Do My Best

0개의 댓글