◦ Algorithm/Python

리스트에 map 사용하기

밍블리s2 2023. 3. 19. 12:18
n = int(input())

call = list(map(int, input().split()))
print(call)

call = map(int, input().split())	# map 객체 생성
print(call)	# map 안의 내용 볼 수 없음
print(list(call))	# list로 출력해야 함

input으로 정수 여러 개 받아올 때 map으로 입력값을 int로 형변환해주고 각 원소를 리스트에 담기