0
Input()
How can i input list instead of one item
2 Réponses
0
hassan Saber you have to input everything upfront on the initial console request as
76
53
82
61
37
49___________submit
Sololearn python playground is not structured to roll input()
Ofcourse there is always the simple way
n = [76, 53, 82, 61, 37, 49] # as a hardcode list
0
or you can input comma separated or space-separated items then use strip and split.
2,4,6,8,10
submit
numlist = map(int, input().strip().split(','))
or
or
apples banana cherry durian
submit
fruits = input().strip().split()
use strip() to cleanup any extra whitespace the user might have added at the beginning or end of the input.



