Answer to Question #205749 in Python for Emm

Question #205749

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()


1
Expert's answer
2021-06-11T05:06:44-0400
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)





Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

Ask Your question

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS