I failed this in a mock exam of python?
1. Write a program to calculate and return the sum of distances between the adjacent number in an array of positive integers. Note: You are expected to write code in the find total distance function only which receives the first parameter as the numbers of items in the array and the second parameter is the array itself. You are not required to take the input from the console. Example Finding the total distance between adjacent items of a list of 5 numbers. Input input 1: 5 input 2 : 10 11 7 12 14 Output #This is the inbuilt code and solution which i written and getting error for cls and input1&input2 which is already given in code inbuilt Code given in exam and solution i wrote: ------------ class UserMainCode(object): //inbuilt given def findTotalDistance(cls,input1, input2): #Write your code here total = 0 for i in range(n-1): total+= abs(numbers[i]-numbers[i+1]) return total n = int(input()) numbers= list(map(int, input().split())) print(findTotalDistance(n, numbers)) Solution2: This is same soluion of question but it is not giving right result as from the inbuilt code (cls,input1,input2) which is given applying in tjat this logic of solution it is giving wrong result?Please anyone help it out def findTotalDistance(n,numbers): total = 0 for i in range(n-1): total+= abs(numbers[i]-numbers[i+1]) return total n = int(input()) numbers = list(map(int, input().split())) print(findTotalDistance(n,numbers))