Ad
  • Default User Avatar

    Let say you have this array
    integers = [1,1]
    for i in range(0, a_len) will be expanded to for i in [0,1]
    the first time i = 0
    when executing integers.count(1), it will return 2
    then you delete from the integers array once, the array now is 1 element long.
    In the second iteration i is equal to 1, but the numbers only have 1 element (you erased one),
    trying to access its index 1 will throw an exception

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    arr_new.count(x) will alwasy be 0, because the array is empty.