+ 1
Alternative multy input
User input n integers How i can get a list of input with short code? Long code us: A=int(input()) B=int(inout()) ..... W124=int(input())
4 Answers
+ 6
ŠŠ¾ŠŗŠ¾ ŠØŠ° ,
what have done so far to find a proper way for this task?
can you post your try here:
> put your code in playground, save it there, create a link from the code and post this link here.
+ 3
If it meets your needs you could take all the inputs from the user at once, separated by spaces or commas for example and use .split() to populate list 'L'.
For example:
l = input().split()
print(l)
Would do as you need if the numbers were '1 2 3 4 5 6 7 8'.
However, these produce a list of strings and not integers. If you combine it with list comprehension and write:
l = [int(x) for x in input().split()]
print(l)
you will generate a list of integers.