Q.32

PHOTO EMBED

Sat Jan 08 2022 12:34:24 GMT+0000 (Coordinated Universal Time)

Saved by @di


"""
Write a Python program to get a string from a given string where all occurrences of its first char have been changed to '$', except the first char itself.  
Sample String : 'restart'
Expected Result : 'resta$t'
"""
def change_char(str1):
    char=str1[0]
    str1=str1.replace(char,'$')
    str1=char+str1[1: ]
    return str1
print (change_char('restart'))
content_copyCOPY

https://www.onlinegdb.com/online_python_compiler