In python: For a string s, and a character as input, create a function that will print each character of s but when the character input appears in the string add an asterisk beside the matching character. Each time the letter appears add an extra asterisk.
make this a function and use for i in range()
def displayNewString(message, character):
  for i in range(0,len(message)):
    if(character==message[i]):
      print("*",end="")
    else:
      print(message[i],end="")
message=input()
character=input()
displayNewString(message, character)
Comments
Leave a comment