In: Computer Science
Here is the function, no dictionary were used ================================================================ def clean_word(sentence): cleaned_word = '' filtered = '!.?:,\'"-_\()[]{}%0123456789' for letter in sentence: if letter not in filtered: cleaned_word += letter return cleaned_word.lower() def main(): print(clean_word("co-operate.")) print(clean_word( "Anti-viral drug remdesivir has little to no effect on Covid patients' chances of survival, a study from the World Health Organization (WHO) has found.")) print(clean_word('1982')) print(clean_word("born_y1982_m08\n")) main()
==================================================================