Skip to main content

Read about Python Programming Language.

      

Hello Friends.


In Our Previous Blog, We have Learned the Basics of Python Programming Language & Simple Program in Python Programming Language.
In Today's Blog We Will Create Some Basic Program in Python Programming Language.


Print List Item in Assending Order Without Using Sort Function Program in Python Programming Language.


Assending Order- Program

#List in Assending Order

list=[9,5,1,7,5,3,6,2,8,0]

for i in range(0,len(list)):

    for j in range(i+1,len(list)):

        if list[i]>list[j]:

            temp=list[i]

            list[i]=list[j]

            list[j]=temp

print(type(list))

print("Assending Order = ",list)    


Output

<class 'list'>

Assending Order =  [0, 1, 2, 3, 5, 5, 6, 7, 8, 9]


Print List Item in Dessending Order Without Using Sort Function Program in Python Programming Language.


Dessending Order- Program

#List in Dessending Order

list=[9,5,1,7,5,3,6,2,8,0]

for i in range(0,len(list)):

    for j in range(i+1,len(list)):

        if list[i]<list[j]:

            temp=list[i]

            list[i]=list[j]

            list[j]=temp

print(type(list))

print("Dessending Order = ",list)


Output

<class 'list'>

  Dessending Order =  [9, 8, 7, 6, 5, 5, 3, 2, 1, 0]


If You want to Know the Basics of Python Programming Language then Click On this Link.


If You want to Know about Information Technology or It Technology, Then Click on the Link given above.

If you want to see Our Privacy Policy then You Can Click on this Link.



Hope, You Enjoy this Our Blogs on Python Language.



Comments