How to reverse the list . | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to reverse the list .

Is it sort.(reverse=true)

4th Dec 2020, 7:45 AM
Balz_andras
8 Answers
+ 8
In python, you can reverse and sort a list by simply typing List.sort(reverse=True) or VariableName=sorted(List, reverse=True)
4th Dec 2020, 8:00 AM
R_A
+ 2
In which language do u want? Please mention it in the question.
4th Dec 2020, 7:46 AM
Charitra
Charitra - avatar
+ 2
You are most welcome!
4th Dec 2020, 8:02 AM
R_A
+ 1
Thank you bro
4th Dec 2020, 8:01 AM
Balz_andras
+ 1
a = [1,2,3] rev_a = a[::-1] print(rev_a)
4th Dec 2020, 8:03 AM
Slick
Slick - avatar
0
the language
4th Dec 2020, 7:52 AM
Samuel Wekobosya
Samuel Wekobosya - avatar
- 1
Thanks for your reactions
4th Dec 2020, 8:01 AM
Balz_andras
- 1
in Python just write list_name = listname[::-1]
5th Dec 2020, 9:02 AM
Aradhay Mathur
Aradhay Mathur - avatar