In this program, we will add elements from one list to another list and print It in descending order.
Steps to solve the program
- Take a list as input and create another empty list.
- Use for loop to iterate over all the elements of the list.
- During iteration add elements to the empty list.
- Print the list in descending order using sorted().
l1 = [2,5,8,0,1,4]
l2 = []
for ele in l1:
l2.append(ele)
sorted(l2,reverse = True)
Output :
[8, 5, 4, 2, 1, 0]