Skip to main content
edited tags
Link
Linny
  • 10.4k
  • 5
  • 37
  • 99
tag
Link
dfhwze
  • 13.9k
  • 3
  • 38
  • 101
Became Hot Network Question
Tweeted twitter.com/StackCodeReview/status/1139820022518472704
deleted 27 characters in body; edited title
Source Link
200_success
  • 144.2k
  • 22
  • 188
  • 473

Explicit Song Checkersong lyrics checker

To stay in practice with my PythonPython I've decided to write an explicit song checker. It checks each word in the song against an array of 14 explicit words contained in the text 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 codenot sure about the rule of having explicit words in a program's code. Feedback on efficiency and structure is what I'm going for mostly. Style and other critiques are invited as well.

EDIT These are text files, and there are 14 words in the explicit_words array.

explicit_song_checker.py

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()

Explicit Song Checker

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.

EDIT These are text files, and there are 14 words in the explicit_words array.

explicit_song_checker.py

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()

Explicit song lyrics checker

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 14 explicit words contained in the text 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 program's code. Feedback on efficiency and structure is what I'm going for mostly. Style and other critiques are invited as well.

explicit_song_checker.py

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()
Capitalization, minor formatting
Source Link
AJNeufeld
  • 34k
  • 5
  • 39
  • 101
Loading
added 79 characters in body; added 5 characters in body
Source Link
Linny
  • 10.4k
  • 5
  • 37
  • 99
Loading
Source Link
Linny
  • 10.4k
  • 5
  • 37
  • 99
Loading