def remove_i (s): '''Return a new string that is the same as s, but with all instances of the letter i removed.''' while s.count("i") > 0: # remove the next occurrence of "i" where = s.find("i") # remove the character at position "where" in "s". s = s[0:where] + s[where+1:] return s if __name__ == "__main__": text = "Indiana Illinois" print text text = remove_i(text) print text,"should be Indana Illnos" text = "" text = remove_i(text) print text,"should be the empty string" text = "aa bb cc dd" text = remove_i(text) print text,"should be aa bb cc dd"