From this tutorial, you’ll be studying about Reverse list python methodology. You will see how to apply it to sequences with the assistance of examples.

**Note:** The syntax used in the beneath part is for Python 3. You can change it to another variations of Python.

Contents

## Reverse List Python

**To Learn about Lists – Read Python List**

### List Reverse Method

The Reverse methodology permits you to invert the order of an inventory of parts. You can use this methodology to change the precedence of sorting order, and so forth.

Its syntax is as follows:

List_name.reverse()

This methodology counts the variety of cases of a component in an inventory. See the beneath instance.

### How does the Reverse() perform work?

This methodology doesn’t settle for any argument and additionally has no return worth. It solely creates an up to date checklist which is the reverse of the unique sequence.

Please do not confuse the reverse() methodology with reversed(). The latter permits accessing the checklist in the reverse order whereas the reverse perform merely transposes the order of the weather.

The flowchart beneath makes an attempt to clarify it in a diagram:

### Program Examples

#### Reversing an inventory of numbers

# Initilize the checklist of numbers Cubes = [1,8,27,64,125] Cubes.reverse() print (Cubes)

The consequence is as follows:

[125, 64, 27, 8, 1]

#### Reversing an inventory containing strings

# Initialize the checklist of strings Mathematics = ["Number Theory", "Game Theory", "Statistics", "Set Theory"] Mathematics.reverse() print (Mathematics)

The consequence is as follows:

['Set Theory', 'Statistics', 'Game Theory', 'Number Theory']

#### Reversing an empty checklist

# Initialize an empty checklist List = [] List.reverse() print (List)

The consequence is as follows:

[]

###Python Tutorial###

[ad_2]

Reverse list python, For more Search in Wikpedia

Reverse List Python | Python examples for Beginners to Advance – My programming school