37562/print-a-list-in-both-ascending-and-descending-order
I use sort() in Python but it sorts the list in ascending, how to sort it in descending order?
You can use listName.sort(reverse=True). This will sort the list in descending order.
>>> numbers = [3,5,6,2] >>> numbers.sort(reverse=True) >>> print(numbers) >>> 6 5 3 2
Hi, @There, Given an array of size n, ...READ MORE
This is the code that I am ...READ MORE
ou are using Python 2.x syntax with ...READ MORE
x = int(input("Enter any number \n")) print("The factors ...READ MORE
You can also use the random library's ...READ MORE
Syntax : list. count(value) Code: colors = ['red', 'green', ...READ MORE
Enumerate() method adds a counter to an ...READ MORE
You can simply the built-in function in ...READ MORE
Try using this question by list comprehension: a=[4,7,3,2,5,9] print([x for ...READ MORE
Hi @Mike. First, read both the csv ...READ MORE
OR
At least 1 upper-case and 1 lower-case letter
Minimum 8 characters and Maximum 50 characters
Already have an account? Sign in.