Censor Dispenser: Not Sure How to do the Final Challenge

I’m having a bit of trouble figuring out how to do the final challenge for the Censor Dispenser project. I figure it has something to do with the indices of the words that come before and after censored words, but I’m not entirely sure how to go about censoring words that come before or after when the lengths might be different. I’ve kind of built up my functions off of the previous ones (i.e. my negative word censor builds off of the proprietary terms censor to save on lines and reduce rewritten code). Please find attached the link to my code:

Any advice is greatly appreciated – including general style and formatting tips.

Thank you!

Hello @designsurfer17101, welcome to the forums! Have you considered using the range() function? What would that imply, and how would you use range to censor words?