An array
in python is used to store multiple values of the same datatype
in a single variable.
The reverse()
function is simply used to reverse the order of the items in a given array.
array.reverse()
The reverse()
method takes no parameter value.
The reverse()
function returns the reversed array as an output.
# importing the array moduleimport array as arr# creating an integer data type arrayx = arr.array('i', [1,2,3,4,5,6,7])# reversing the arraay using the reverse methodx.reverse()# Printing the reversed arrayprint(x)