Coding question: replace a char in a string with another string.
Anoniem
# Python Code def replaceCharacter(s, characterToBeReplaced, replacement): retVal = "" for i in s: if i == characterToBeReplaced: retVal += replacement else: retVal += i return retVal print replaceCharacter("HowIsaPresidentYourFrat", "a", "SAMMY")