Program - Consider an array of non-negative integers. A second array is formed by shuffling the elements of the first array and deleting a random element. Given these two arrays, find which element is missing in the second array.


Topic: Program - Consider an array of non-negative integers. A second array is formed by shuffling the elements of the first array and deleting a random element. Given these two arrays, find which element is missing in the second array.

Solution

first_array = [1,2,3,4,5,6,7]
second_array = [3,7,2,1,4,6]
def finder(first_array, second_array):
    return(sum(first_array) - sum(second_array))
missing_number = finder(first_array, second_array)
print(missing_number)



List all Python Programs