list sort python
Python Program to get list size n and n elements of list, then sort the elements of list in ascending order.
Sample Input 1:
5 5 7 9 3 1
Sample Output 1:
1 3 5 7 9
Program or Solution
l=list(map(int,input("Enter Numbers:").split()))
for i in range(0,len(l)-1):
for j in range(0,len(l)-1):
if(l[j+1]<l[j]):
l[j],l[j+1]=l[j+1],l[j]
print(l)
Program Explanation
Bubble Sort Algorithm: Refer : https://www.tutorialspoint.com/data_structures_algorithms/bubble_sort_algorithm.htmComments
Related Programs
- list input in python
- sum of list in python | without using built-in function
- Average of list in python | without using built-in function
- linear search in python
- largest element in the list python | without using built-in function
- smallest element in the list python | without using built-in function
- Print all the numbers which are less than given key element from a given list.
- delete element in list python
- Revese the elements in list python
- Reverse the first half of list elements in python
- Reverse the second half of list elements in python
- list sort descending order python
- Python Program to sort half of the list elements in ascending order and next half in descending order.
- merging two lists in python
- Python Program to replace every element with the greatest element on right side
- circular list rotation in python
coming Soon
coming Soon