You are presented with two arrays, all containing positive integers. One of the arrays will have one extra number, see below:
[1,2,3]
and [1,2,3,4]
should return 4
[4,66,7]
and [66,77,7,4]
should return 77
My code:
def find_missing(arr1, arr2):
if len(arr1) != len(arr2):
for i in arr1 and arr2:
if arr1[i] != arr2[i]:
return i
Is producing this error:
Traceback (most recent call last): File "python", line 1,
in <module> File "python", line 4, in find_missing
IndexError: list index out of range