Consider the following code:
code = input()
eval(code)
If I run it and type
> print(10)
It will get executed and print "10"
My question is when the code needs an indent, such as:
> for i in range(10):
> print(i)
How can I receive this code with input()
(notice that I have to keep the indent) so that I can use eval()
to run it?