0

I currently am using the following code to read in a string of integers separated by spaces as integers:

temp = input().split()
array =[]
for i in range(len(temp)):
    array.append(int(temp[i]))

it seems like there should be a more efficient way to do it. Is there? If so how?

luke
  • 17
  • 7

1 Answers1

0
array = list(map(int, input().split()))
petrch
  • 1,807
  • 15
  • 19