한 줄에 여러값 입력받기
ls.append( ~~~) 안에
- list(map(int,input().split()))
- set(map(int,input().split())) → pop 했을때 순서대로가 아닌 정렬되서 나옴
- map(int,input().split())
-> 뭘 하던간에 a,b= ls.pop(0)하면 하나씩 값 받아옴
값꺼내서 쓸꺼면 굳이 list 쓸필요 없이 바로 넣어도 된다.
n,m=map(int,input().split())
ls=[]
for i in range(m):
ls.append(map(int,input().split()))
while ls:
a,b=ls.pop(0)
print(a,b)
#입력
4 2
12 3
15 4
#결과
12 3
15 4
'코딩테스트 > Python 개념' 카테고리의 다른 글
| [Python] 순열, 조합 직접 구현 (0) | 2023.02.24 |
|---|---|
| [Python] 정수 최댓값, 최솟값 초기화: -1e9, 1e9 (0) | 2023.02.15 |
| 누적합 축적 accumulate() (0) | 2023.02.08 |
| [Python] 출력시 공백 추가 end, sep (0) | 2023.01.28 |
| [Python] 평균, 중앙값 numpy (0) | 2023.01.05 |