Select Page

# Data reverse

by | Aug 23, 2021 | Assignment Help

ONE_TEN = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]def swapFirstLast (data):  temp1 = data [0]  data.reverse()  temp2 = data[0]  data[0] = temp1  data.reverse()  data[0] = temp2def shiftRight (data):  temp1 = data[0]  length = len(data)  data2 = []  for i in range (length):    data2.append(data[i-1])  data = list(data2)  print (data,’b’)def replaceEven(data):  length = len(data)  data2 = []  for i in data:    if i % 2 != 0:      data2.append(i)    else:      data2.append(0)  data = list(data2)  print (data, ‘c’)def main():  print (“The original data for all functions is: “, ONE_TEN)  data = list(ONE_TEN)  swapFirstLast(data)  print (“After swapping first and lst: “, data)  data = list(ONE_TEN)  shiftRight(data)  print (“After shifting right: “, data)  data = list(ONE_TEN)  replaceEven(data)  print(“After replacing even elements: “, data)if __name__ == “__main__”:  main()why do i get a different output between print(data, ‘b’) and main

#### This is a sample question

Need help with a similar assignment?

Place an order at Study Pirate

Attach all custom instructions.

Make Payment. (The total price is based on number of pages, academic level and deadline)

We’ll assign the paper to one of writers and send it back once complete.