본문 바로가기

알고리즘/기초

파이썬 함수

순열 조합

순열 from itertools import permutations

permutaions([],2)

조합 from itertools import combinations

중복순열 from itertools import product

중복조합 from itertools import combinations_with_replacmnt

 

진수

2진수 bin()

8진수 oct()

16진수 hex()

 

unicode

chr()

ord()

 

arr=[1,2,3,4,5]

sum(arr,6)=21

이어서 더하기 가능

 

reverse()

 

str.upper()

str.lower()

str.title()

str.swapcase()

str.capitalize()

 

zip()

 

enumerate()

 

sort()

sorted()

sorted(arr, key=lambda x: x%3)

 

count()

found()

 

startswith()

endswith()

 

str.isdigit()

str.isalpha()

str.isalnum():

str.istitle()

str.islower()

str.isupper()

 

 

'알고리즘 > 기초' 카테고리의 다른 글

[알고리즘] DFS & BFS  (0) 2022.04.13