-
[python]count_occurrences /degrees_to_rads/*difference30 seconds of Code 2022. 2. 4. 16:11
*는 고민했던 문제
count_occurrences
def count_occurences(lst, val): print(lst.count(val)) >> count_occurences([1,21, 2, 1, 2, 3], 1) #2 리스트명.count(세고싶은 인덱스)
degrees_to_rads
1도 = 파이/180
x도 = x * 파이 / 180
def degrees_to_rads(degree): print(degree * math.pi / 180) >>> degrees_to_rads(180) # ~3.1416
*difference
def difference(a,b): newb = set(b) print([c for c in a if c not in newb])
반응형'30 seconds of Code' 카테고리의 다른 글
has_duplicates (0) 2022.02.08 filter_non_unique (0) 2022.02.08 왼손코딩 1일1파이썬 9,10,11,12 (0) 2022.02.04 파이썬 join, os.path.join (0) 2022.02.03 [python]Compact (0) 2022.01.28