You are on page 1of 1

Lists

Exercise 1: Reverse a given list in python

Solution 1:
aLsit = [100, 200, 300, 400,
500]
aLsit = list(reversed(aLsit))
print(aLsit)

Solution 2:
aLsit = [100, 200, 300, 400,
500]
print(aLsit[::-1])

Solution 3: Getting input from the user


x = input()
x =list(x.split())
print(x[::-1])

Exercise 2: Concatenate two lists index wise

Solution 1:
list1 = ["M", "na", "i", "Ke"]
list2 = ["y", "me", "s", "lly"]
list3 = [i+j for i,j in zip(list1,list2)]
print(list3)

You might also like