Reverse string in python | Syntax for reverse() List Method in Python.

reverse string python

Python – reverse

reverse() method is used to reverse the given list.

Flowchart:-

Sirf Padhai

Syntax for reverse() List Method in Python

list.reverse()

Parameter : There is no parameter for reverse() method.

Returning Value: reverse() method returns ‘None’.

Example for reverse() List Method in Python

list = ["S", "i", "r", "f", "p", "a", "d", "h", "a", "i"]
list.reverse()
print(list)

Output :

['i', 'a', 'h', 'd', 'a', 'p', 'f', 'r', 'i', 's']

Previous articlePython: Print the square and cube symbol in the area of a rectangle and volume of a cylinder
Next articlePython: Split a string on the last occurrence of the delimiter| split string last occurrence python

LEAVE A REPLY

Please enter your comment!
Please enter your name here