python

List in reverse

This snippet will allow you to create a list in reverse

# We can create a list with items of different types
b = [49, "Ebrahim", True, 4.4]
print(b)
print(b[::-1]) # Can be sliced
Was this helpful?