list sort descending order python

Description

Python Program to get list size n and n elements of list, then sort the elements of list in descending order.
Input:
5
5 7 9 3 1
Output:
9 7 5 3 1

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)

Explanation

Bubble Sort Algorithm: 
Refer : https://www.tutorialspoint.com/data_structures_algorithms/bubble_sort_algorithm.htm



Interesting Pattern Programs: for more Patterns

Input:
5
Output:
*
**
***
****
*****
****
***
**
*Solution
Input:
5
Output:
    *
   ***
  *****
 *******
*********
 *******
  *****
   ***
    *Solution
Input:
5
Output:
*        *
**      **
***    ***
****  ****
**********Solution
Input:
5
Output:
*       *
**     **
***   ***
**** ****
*********Solution
Input:
5
Output:
*       *
**     **
***   ***
**** ****
*********
**** ****
***   ***
**     **
*       *Solution
Input:
5
Output:
*********
 *******
  *****
   ***
    *
   ***
  *****
 *******
*********Solution