Ad
  • Default User Avatar

    Adding substance to the above critisizm, in your 'for loop' notice the following:

    for i in range(0, 4):

    will only check your remaining if, elif, else statements for the index 0 to 3 in arr1, arr2.

    for i in range(0, len(arr1)):

    will check those statements for the index 0 up to len(arr1) - 1 (this allows the program to scale with a possible change in list size)

    We are told the list length will be the same so modifying your program with this new range in your for loop will suffice.

    :P

  • Custom User Avatar

    If it was >= then v could take the v = 0 value in the condition and then you would indeed have a division by 0. Without the = sign, the condition goes to the else part and no division by zero is performed.

  • Default User Avatar

    This solution seems incomplete. You're assuming that each test case will have exacly 4 test questions. It is a big flaw. No offence

  • Default User Avatar

    this gives error when v is 0. should be >=