ERROR # # UNQ_C2 # GRADED FUNCTION: insert_audio_clip

Getting below error

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

in insert_audio_clip_test(target)
5 duration = segment_time[1] - segment_time[0]
6 assert segment_time[0] > 4400, “Error: The audio clip is overlaping with the first segment”
----> 7 assert duration + 1 == len(activates[0]) , “The segment length must match the audio clip length”
8 assert audio_clip != backgrounds[0] , “The audio clip must be different than the pure background”
9 assert segment_time == (7286, 8201), f"Wrong segment. Expected: Expected: (7286, 8201) got:{segment_time}"

AssertionError: The segment length must match the audio clip length
my code is

{mentor edit: code removed}

Dear Deeplearning Team please help me out

Please don’t post your code on the forum unless you’re asked to. Posting your code breaks the course Honor Code.

The instructions for Step 2 say to check if the segment time overlaps. You have a function is_overlapping() for that. Testing “segment_time” is not sufficient.

I’m confused with the logic of what is going on, as mentioned in the instructions that:
(* Make sure that the time segment does not overlap with any of the previous time segments.
If it is overlapping, then go back to step 1 and pick a new time segment.)

we have to check the overlapping with the previous implemented function ‘is_overlapping’
so we pass ‘is_overlapping’ function with ‘segment_time , previous_segments’ as arguments to if statement to check either True or False
But you are saying that is wrong, I don’t get it
please explain more

FOUND IT, my logic was not interfering with what you said. the problem was found in While loop I was passing the wrong condition

My reply was to a question from a student from eight months ago.
The student did not use the is_overlapping() function in his code for Step 2.
My reply says you should use the is_overlapping() function.

1 Like

thanks anyway for your time