I'm wondering where I'm going wrong. The object is to replace the letters e in a user input with an X and a space with a * . This is all done in python and the result should be hxllo*world
i=0
str=input('please enter a phrase ')
numberOfChar=len(str)
copy=''
while i < numberOfChar:
if str[i] == 'e':
copy=str.replace('e','x')
elif str[i] == ' ':
copy=str.replace(' ', '*')
i = i+1
print(copy)
Thank you
Bit more info:
It's for college and had to use a while loop and a if function. When I realised that the street.replace referred to the variable name and not mistakenly on my part the function name it all became clear. Thank you all
stris a python type, so you shouldn't use it as a variable name.