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
can you give an example using a ...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
Already have an account? Sign in.