I am writing a code that removes '√' symbol from a string and get's the index of it, By using the 'enumerate' function in python, I have already made an functioning calculator but I am improving it.
Code:
cal = input(">>> ")
for i, c in enumerate(cal):
if c == '√':
cal = cal[0:i]+cal[i+1:]
print(cal)
Input:
>>> 123√456√789√123
Output:
123456√89√13
I am not getting the right output when I remove a character from the string the enumerate function messes up the index , So I can't figure it out. [My first time using stackover flow Don't judge]