Computer Science, asked by satishsidhar5197, 1 year ago

Write a program to pass any list and to arrange all numbers in descending order.

Answers

Answered by NirmalPandya
1

• Program to pass any list and to arrange all numbers in descending order:

# List of integers

num = [10, 30, 40, 20, 50]

# sorting and printing

num.sort(reverse=True)

print (num)

# List of float numbers

fnum = [10.23, 10.12, 20.45, 11.00, 0.1]

# sorting and printing

fnum.sort(reverse=True)

print (fnum)

# List of strings

str = ["Banana", "Cat", "Apple", "Dog", "Fish"]

# sorting and printing

str.sort(reverse=True)

print (str)

Similar questions