Python_program 3

Practical Name: 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.

_______________________________________________________________

Program :

str=input("Enter string:")

str=str.replace('r','$')

print("Modified string is :")

print(str)

 

 



Output:


Post a Comment

Previous Post Next Post