# Program to remove emoticons. string_with_emoticons = "Oh, hai! Can I haz cheezeberger? :D :D" emoticons = (":D", ":)", ":/", ":p", ";)") for emoticon in emoticons: if (emoticon in string_with_emoticons): # Find the start index of the current emoticon. emoticon_start = string_with_emoticons.find(emoticon) # Use a slice to copy everything left of the emoticon. substring_left = string_with_emoticons[: emoticon_start - 1] # Use a slide to copy everything right of the emoticon. substring_right = string_with_emoticons[emoticon_start + 2:] # Make a new string without the emoticon in it. string_with_emoticons = substring_left + substring_right print(string_with_emoticons)