i have this failed test when i use check50 in pset6 bleep
:( handles banned words lists with arbitrary words in them
running python bleep.py banned2.txt... sending input My cat and dog are great... checking for output "My *** and *** are great "...
every other test case passed.
This is my code
def main(): if not len(argv) == 2: print("Usage: python bleep.py dictionary") exit(1) else: ban = set() # open banned words file to read with open("banned.txt", "r") as f: # copy words to the set for line in f: ban.add(line.strip()) # prompt user for message msg = get_string("What message would you like to censor?\n") # split msg to words msg_words = msg.split(" ") msg_censor = "" # censor banned words for word in msg_words: if word.lower() in ban: msg_censor += ("*" * len(word)) + " " else: msg_censor += word + " " # print censored msg print(msg_censor.strip())
No specification was provided regarding handling banned words lists with arbitrary words in them, what does that mean?