사실 플그래머스로 하려면 별로 필요 없긴하지만..
from sys import stdin
input()
list(map(int, input().split())
list(map(int, stdin.readline().split()) # 이렇게 하면 input보다 빨리 읽음
zip, enumerate
https://docs.python.org/ko/3/library/functions.html?highlight=enumerate#enumerate
lst = [1,2,3]
lst2 = [1,2,3]
from (key val) in enumerate(lst, start=0):
print(key, val)
from (a, b) in zip(lst, lst2):
print(a,b)
순열, 조합 등 더 신기한것들도 많다 → https://docs.python.org/ko/3/library/itertools.html?highlight=itertools
from itertools import product,collections, permutations
lst = [1,2,3]
lst2 = [1,2,3]
a = product(lst, lst2, repeat=2) # 2차원 가능, 가능한 조합 모두
a = permuations(lst) # 순열
a = combinaions(lst, 2) # 조합, 리스트 중 2개 뽑기
defaultdict
from collections import defaultdict
a = defaultdict(int) # 어떤키든 초기값이 0인 dict
a = 'hi'
lst2 = [1,2,3]
print(a[::-1]) # 역슬라이싱
"".join(lst2) # "123"
a.replace('h', 'i') # ii
from datetime import datetime, timedelta, date
delta = timedelta (days=50, seconds=27 ...)
# 검색해서 봐야할 것 같음
date.fromisoformat('2019-12-04')
date(2003, 12, 29).isocalendar()
>> datetime.IsoCalendarDate(year=2004, week=1, weekday=1)
# 기본적으로 쓰는 형식 지원
datetime.fromisoformat('2011-11-04 00:05:23.283')
import math
a = 1
b = 2
min_val = min(a,b)
max_val = max(a,b)
abs_val = abs(a) # 1, 절대값 리턴
pow_val = pow(a,2) # 1, 제곱수 리턴
round(a) # 정수 반올림 값, 0.5라면 짝수와 가까운 값을 리턴
math.ceil(a) # 소수 올림값
math.floor(a) # 소수 내림값
sqrt(a) # 제곱근 (루트 먹인값)