How to sort ascending and descending order in python

angryTom
Release: 2020-03-02 17:31:16
Original
27789 people have browsed it

How to sort ascending and descending order in python

Recommended: "python video tutorial"

1 , First open the cmd command prompt, enter the command "ipython" to open the python command line tool:

How to sort ascending and descending order in python

2. First define a variable number array in the command line, and write in it Enter several numbers, use the sorted function to sort the numbers, and assign the sorted result to variable a. The first parameter of the sorted function is the parameter to be sorted, and the second is the fixed parameter reverse, which means reverse order. True is turned on:

How to sort ascending and descending order in python

#3. Finally print out the a scalar, which is output in descending order:

How to sort ascending and descending order in python

For more related questions, please pay attention PHP Chinese website!

The above is the detailed content of How to sort ascending and descending order in python. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!