Easy Tutorial
❮ Python Func Number Asin Python Os Close ❯

Python3 List reverse() Method

Python3 List


Description

The reverse() function is used to reverse the elements in a list.

Syntax

The syntax for the reverse() method is:

list.reverse()

Parameters

Return Value

This method does not return any value but reverses the elements of the list in place.

Example

The following example demonstrates the use of the reverse() function:

#!/usr/bin/python3

list1 = ['Google', 'tutorialpro', 'Taobao', 'Baidu']
list1.reverse()
print("Reversed list: ", list1)

The output of the above example is:

Reversed list:  ['Baidu', 'Taobao', 'tutorialpro', 'Google']

Python3 List

❮ Python Func Number Asin Python Os Close ❯