Sunday, March 3, 2019

Sorting using User Define Function - Python3

def list_sort(list):
        list.sort()
        print('Sorted list: ',list)
    
list = []
len = int(input('Enter length of list: '))
for i in range(len):
    item = int(input('Enter %dth element: '%i))
    list.append(item)
print('Original list: ',list)
list_sort(list)

ScreenShot:



No comments:

Post a Comment