Your code for the while statement should use the is_overlapping() function. Its job is to compare the segment_time and the previous_segments. The is_overlapping() function returns a boolean.
You do also need the ‘and’ test for the retry counter.
Thanks a lot sir, Kindly vet my code as i am still getting some error;
while is_overlapping(segment_time, previous_segments) and retry >= 0:
segment_time = previous_segments
retry = retry - 1
### END CODE HERE ### #print(segment_time)
# if last try is not overlaping, insert it to the background
if not is_overlapping(segment_time, previous_segments):
### START CODE HERE ###
# Step 3: Append the new segment_time to the list of previous_segments (≈ 1 line)
previous_segments.append(segment_time)
### END CODE HERE ###
# Step 4: Superpose audio segment and background
new_background = background.overlay(audio_clip, position = segment_time[0])
else: #print(“Timeouted”)
new_background = background
segment_time = (10000, 10000)