파이썬 자주 사용하는 라이브러리 모음 - 코테 꿀팁
1. mathimport mathprint(math.factorial(5)) # 5! = 120print(math.gcd(36, 60)) # 최대공약수(GCD) = 12print(math.sqrt(25)) # 제곱근 = 5.0print(math.ceil(3.1)) # 올림 = 4print(math.floor(3.9)) # 내림 = 32. itertoolsimport itertoolsarr = [1, 2, 3]# 순열 (3개 중 2개를 선택하는 모든 경우) -> 순서 의미 있음print(list(itertools.permutations(arr, 2)))#[(1, 2), (1, 3), (2, 1), (2, 3), (3, 1), (3, 2)]# 조합 (3개 중 2개를 뽑는 경우) -> 순서 ..
2025. 3. 22.