Reversing a List in Python

 

Reversing a List in Python



Code -
---------------------

# Reversing a list

# Method 1
f = [1, 3, 4, 5, 6, 6, 7, 43, 3, 5, 45]
f = [i for i in reversed(f)]
print(f)

# Method 2
f.reverse()
print(f)

Comments

Popular posts from this blog

Shopping Bill Generator In python.

Should we start preparation for BCA/MCA from class 11th ? How ?

Python program to check that a list have elements in it or not .