To stay in practice with my
python I’ve decided to write an explicit song checker. It checks each word in the song against an array of explicit words contained in the file. I’ve decided not to include the words that are to be checked against, for I am not sure about the rule of having explicit words in a programs code. Feedback on efficiency and structure is what I’m going for mostly. Style and other critiques are invited as well.
explicit_words = [ #explicit words not shown ] def isClean(song_path): with open(song_path) as song: for line in song: words = line.split(" ") for word in words: for explicit_word in explicit_words: if word == explicit_word: return False return True def main(): song = raw_input("Enter path to song: \n") if isClean(song): print("CLEAN") else: print("EXPLICIT") if __name__ == '__main__': main()