I am basically writing a simple function in which the user enters a sentence (strng), a letter (letter) and another letter (replace) to replace the first letter with. Here's what I have:
def letter_replace(strng, letter, replace):
replace = str(replace)
for char in strng:
if char == letter.upper() or char == letter.lower():
strng.replace(char, replace)
return strng
else:
return "Sorry, the letter could not be replaced."
I can't figure out why this won't work. Sorry if it's a completely obvious mistake, I am fairly new to Python. Thanks