I want to input in inline
1. input number : 5
2. 1 5 3 4 2
how to receive input for the number of inputs in python?
I've been tried like this:
num=int(input("inputs_num"))
mlist=[]
for i in range(num):
n=int(input())
mlist.append(n)
print(mlist)
I want to input in inline
simple
It will accept multiple integers as input on a single line in Python3
You want to first get the whole line as a string, then split by spaces into a list, then convert each element into int.
So, the flow would look something like:
Or a more pythonic way would be: