Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3322542
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:11:40+00:00 2026-05-17T23:11:40+00:00

Possible Duplicate: How to find positions of the list maximum? A question from homework:

  • 0

Possible Duplicate:
How to find positions of the list maximum?

A question from homework:
Define a function censor(words,nasty) that takes a list of words, and
replaces all the words appearing in nasty with the word CENSORED, and
returns the censored list of words.

>>> censor([’it’,’is’,’raining’], [’raining’])
[’it’,’is’,’CENSORED’]

I see solution like this:

  1. find an index of nasty
  2. replace words matching that index
    with "CENSORED"

but i get stuck on finding the index..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T23:11:41+00:00Added an answer on May 17, 2026 at 11:11 pm

    Actually you don’t have to operate with indexes here. Just iterate over words list and check if the word is listed in nasty. If it is append 'CENSORED' to the result list, else append the word itself.

    Or you can involve list comprehension and conditional expression to get more elegant version:

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Pythonic way to find maximum value and its index in a list?
Possible Duplicate: Find the maximum interval sum in a list of real numbers. I
Possible Duplicate: How to find out where a function is defined? get filename of
Possible Duplicate: How to find out where a function is defined? I am working
Possible Duplicate: How to find ancestor-or-self that is a child of an element with
Possible Duplicate: How to find a list of wireless networks (SSID's) in Java, C#,
Possible Duplicate: How can I find the method that called the current method? I'd
Possible Duplicate: Find url from string with php I found this code: but 2
Possible Duplicate: Algorithm to find Lucky Numbers I came across this question.A number is
Possible Duplicate: How to find out where a function is defined? included php file

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.