Possible duplicate:
How to find the positions of the maximum list?
Question from homework: Define a function censor(words,nasty)that takes a list of words, and replaces all words that look in the disgusting word CENSORED, and returns a censored list of words.
>>> censor([โitโ,โisโ,โrainingโ], [โrainingโ])
[โitโ,โisโ,โCENSOREDโ]
I see a solution like this:
- find the index
nasty - replace the words matching this index with
"CENSORED"
but i'm stuck looking for an index.
Gusto source
share