Skip to content

sabareeshwaran/leaders in a python #3527

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Next Next commit
solution
  • Loading branch information
sabareeshwaran-sureshkumar committed Mar 16, 2023
commit e3d2821d91fe317c70d7614cbca180eba9036d85
18 changes: 18 additions & 0 deletions sort/projectsort.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Creating a bubble sort function
def bubble_sort(list1):
# Outer loop for traverse the entire list
for i in range(0,len(list1)-1):
for j in range(len(list1)-1):
if(list1[j]>list1[j+1]):
temp = list1[j]
list1[j] = list1[j+1]
list1[j+1] = temp
return list1

list1 = []
num=int(input("enter the number of elements in the array : "))
for i in range(num):
arr =int(input("enter the element : "))
list1.append(arr)

print("The leader of the array",list1[-1])