sorting.py
14 linespython
DOWNLOAD
1# Aim: Program to perform sorting (Sorting).
2def sort_list(lst):
3    for i in range(len(lst)-1):
4        for j in range(i+1, len(lst)):
5            if lst[i] > lst[j]:
6                lst[i], lst[j] = lst[j], lst[i]
7
8num = input("Enter a list of numbers separated by commas: ")
9lst = [int(n.strip()) for n in num.split(",")]
10sort_list(lst)
11print("Sorted list:", lst)
12
13        
14