How can i/can i type this code in only one line?

  calculator, python

I made a really simple calculator with this code:

while True:
    calc_input = input("enter calculation")
    print(f"{calc_input} = {eval(calc_input)}")

Me, and my friend (We both are new in programming) tried to convert this to a one line code, but we failed. I need an understandable explanation of how can i type this code in one line (or can i).
(I don’t need the same code in one line, any code in one line that can do the same job as my code would be okay for me.)

Source: Python Questions

LEAVE A COMMENT