list(input()) : 문자열 한 글자씩 분해해서 저장해버리게 된다.
예를 들어, 입력으로 1 0 0 이라고 썼다고 해본다.
- input() → "1 0 0"
- list(input()) → ['1', ' ', '0', ' ', '0'] ← 공백도 문자로 들어가게 된다.
- map(int, input().split()) → [1, 0, 0] ← 숫자만 리스트에 들어가게 된다.
ex) graph = []
graph.append(list(map(int,input().split())))
'Language > python' 카테고리의 다른 글
[파이썬] 백준 뱀 문제 3190 (0) | 2025.04.20 |
---|---|
[파이썬] 백준 로봇청소기 문제 코드 정리. (0) | 2025.04.07 |
deque와 list 차이 (0) | 2025.03.24 |