Python
# Program to sort a list of numbers
numbers = list(map(float, input("Enter numbers separated by space: ").split()))
numbers.sort()
print("Sorted list:", numbers)Output
Enter numbers separated by space: 3 1 4 2 Sorted list: [1.0, 2.0, 3.0, 4.0]
We use the in-place .sort() method to sort the list in ascending order.