Sample Code:
def firstList(secondList):
num = len(secondList)
element = secondList[0]
secondList[0] = secondList[num - 1]
secondList[size - 1] = element
return secondList
secondList = [356, 545, 222, 56, 1]
print(firstList(secondList))
Output = [1, 545, 222, 56, 356]
Copyright © 2024 EHUB.TIPS team's - All rights reserved.
Answers & Comments
Verified answer
Sample Code:
def firstList(secondList):
num = len(secondList)
element = secondList[0]
secondList[0] = secondList[num - 1]
secondList[size - 1] = element
return secondList
secondList = [356, 545, 222, 56, 1]
print(firstList(secondList))
Output = [1, 545, 222, 56, 356]