我希望用户在程序中输入歌词(稍后将扩展到搜索网站,但我目前不需要帮助)并且程序会告诉我输入的信息是否包含列表中的单词。
banned_words = ["a","e","i","o","u"] #This will be filled with swear words
profanity = False
lyrics = input ("Paste in the lyrics: ")
for word in lyrics:
if word in banned_words:
print("This song says the word "+word)
profanity = True
if profanity == False:
print("This song is profanity free")
此代码仅输出“这首歌无亵渎”。