Answer:
def replace_at_index(str, number):
new = str.replace(str[number], "-")
return new
print(replace_at_index("eggplant", 3))
Step-by-step explanation:
- Create a function called replace_at_index that takes a string and an integer
- Initialize a new variable called new, that will hold the new string
- Replace the character at given index with dash using replace function, it takes two parameters: the first is the character we want to replace, the second is the new character.
- Return the new string
- Call the function with the required inputs