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]
>>> 6 5 3 2
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
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:
print([x for ...READ MORE
Hi @Mike. First, read both the csv ...READ MORE
At least 1 upper-case and 1 lower-case letter
Minimum 8 characters and Maximum 50 characters
Already have an account? Sign in.