I\'m new to python and I\'m trying to scan multiple numbers separated by spaces (let\'s assume \'1 2 3\' as an example) in a single line and add it to a list of int. I did i
Maybe this code will help you.
>>> def sort(lists):
... lists.sort()
... return lists
...
>>> datalist = [6,3,4,1,3,2,9]
>>> print(*sort(datalist), end=" ")
1 2 3 3 4 6 9
you can use an empty list variable to collect the user input, with method append().
and if you want to print list in one line you can use print(*list)