본문 바로가기
Algorithm/백준 BOJ

[백준] [Python] input()함수로 입력값 받는 법

by 은세라 2021. 9. 23.

1. 하나의 int

n = int(input())
#3

 

2. 공백으로 구분된 리스트

arr = list(map(int, input().split()))
#40 80 60 - > [40, 80, 60]

 

3. 줄바꿈으로 구분된 리스트

for i in range(7):
    a.append(int(input()))
# 12 -> [12, 77, 38, 41, 53, 92, 85]
# 77
# 38
# 41
# 53
# 92
# 85

 

4. 줄바꿈으로 구분된 리스트의 리스트

arr = [list(map(int, input().split())) for _ in range(n)]

댓글