Course 5 week 3 assignment 2 exercise 3

Hi ! i have a problem with (Exercise 3 - insert_ones) function .
i’m not sure about my for-loop implementation and i encounter with this error


AssertionError Traceback (most recent call last)
in
17 print("\033[92m All tests passed!")
18
—> 19 insert_ones_test(insert_ones)

in insert_ones_test(target)
11 assert arr1[0][segment_end_y - 1] == 0, f"Array at {segment_end_y - 1} must be 0"
12 assert arr1[0][segment_end_y] == 0, f"Array at {segment_end_y} must be 0"
—> 13 assert arr1[0][segment_end_y + 1] == 1, f"Array at {segment_end_y + 1} must be 1"
14 assert arr1[0][segment_end_y + 50] == 1, f"Array at {segment_end_y + 50} must be 1"
15 assert arr1[0][segment_end_y + 51] == 0, f"Array at {segment_end_y + 51} must be 0"

AssertionError: Array at 249 must be 1


and this is my loop

mentor edit: code removed

could someone help me to figure out what is right solution ?

1 Like

Your range value is incorrect.

You need to loop over the next 50 values starting from segment_end_y+1.

4 Likes

thanks a lot for your help it worked :heart: