I have a python program which works as a calculator.
import re
value = 0
run = True
while run:
if value == 0:
equation = input('Enter the equation ')
else:
equation=input(str(value))
# print(equation + ' ')
if equation == 'quit':
run = False
else:
equation = re.sub("[a-zA-Z""]",'',equation)
if value ==0:
# equation=eval(equation)
value=eval(equation)
else:
value=eval(str(value)+equation)
print(equation + ' ')
The program works without problem , but when reading the input after the first iteration , the terminal is as below
python3 file.py
Enter the equation 10+10
20+30
The next input can be provided next to 20. I want to add a space before reading the input , so the output will be as shown below
python3 file.py
Enter the equation 10+10
20 +30
How can I add a space before reading the next input so the cursor will create a space
Example
input=input('Enter the input ')
Python Version : 3.7.7