Respuesta :
def replace_at_index(txt,ind):
new_txt = ""
for x in range(len(txt)):
if x == ind:
new_txt += "-"
else:
new_txt += txt[x]
return new_txt
s = replace_at_index("eggplant", 3)
print(s)
I wrote my code in python 3.8. I hope this helps.
Answer:
def replace_at_index(string, index):
return string[0:index]+"-"+string[index+1:]
replaced_word = replace_at_index("house", 0)
print(replaced_word)
Explanation:
simpler version