Sorting Method
#Bubble Sort
#Sorting Method to sort n numbers in a list
List=[]
n=int(input("Enter the no of numbers in list: "))
for i in range(n):
num=int(input("Enter the no: "))
List.append(num)
print(f"Entered list of numbers is {List}")
def BubbleSort(List):
for i in range(n):
for j in range(0,n-i-1):
if List[j]>List[j+1]:
List[j],List[j+1]=List[j+1],List[j]
BubbleSort(List)
print(f"The sorted list is {List}")

Log in or sign up for Devpost to join the conversation.