The code works well but I have few questions. These are:
1. What's the need of the else statement in the code? What condition is it checking?
2. I understood that the 'join' function adds the contents from the list to the 'text', but how the sequence is maintained? Any clear explanation?
3. Why the 'print' statement is not executing?
text = raw_input("Enter something:") word = raw_input("Enter something:") def censor(text, word): splited_text = text.split() # spliting large string and storing in a variable x =  # declaring empty list for string in splited_text: # iteration through the contents if string == word: string = string.replace(word, "*" * len(string)) # replaces the word with * x.append(string) # stores the new word in the empty list else: x.append(string) #??? text = " ".join(x) #??? print text # statement not executing return text