Course 5 Week 3 Assignment 2 Exercise 4

Hi everyone. I am getting the following ValueError for this exercise. I believe the issue is being caused by this line:

background, segment_time = insert_audio_clip(background, random_activate, previous_segments)

However, I’m not sure what my mistake is. Help would be greatly appreciated.

I think the problem is with the value for previous_segments.
Check all of the functions where you assign that variable.

1 Like

The problem could be in Step 3 in insert_audio_clip().

1 Like

Thank you. I indeed made a mistake for insert_audio_clip() . I appended the wrong thing to previous_segments. I didn’t realize my mistake because I still passed all the tests when I ran that cell. Thanks again.

Can you post your defective code that passed the unit test? I’d like to file an issue report so we can improve that test.

Sure. I accidentally wrote previous_segments.append(previous_segments). Very silly mistake. I am surprised the tests passed.