0

Input()

How can i input list instead of one item

21st Nov 2025, 9:43 PM
hassan Saber
hassan Saber - avatar
2 Respuestas
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
21st Nov 2025, 10:23 PM
BroFar
BroFar - avatar
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.
21st Nov 2025, 11:03 PM
Bob_Li
Bob_Li - avatar