Write a function named "replacement" that takes a string as a parameter and returns an identical string except with every instance of the character "i" replaced with the character "n
python
Code:
def replacement(string):
count=string.count("i")
#HEre we count the no of occurence of i
return string.replace("i","n",count)
#Here we replace the i with n
print(replacement(input("Enter a string : ")))
#HEre we call the function replace() and take user input
Output:
Indentation:
Get Answers For Free
Most questions answered within 1 hours.