+ 2
Ive been wondering why this happens in python. v v v v
input:: num="print('Hello1')" print(num) output:: print('Hello1') For some reason the print command isnt running after compiling. Is there a way to make this work as intended? Desired Output:: Hello1
4 Respuestas
+ 9
Perhaps you mean to actually "execute" the command in question? You should use exec() or eval() for that:
https://code.sololearn.com/cPkjqOVhEGgc/?ref=app
+ 3
num="Hello1"
print(num)
+ 2
@ReimarPB , I am trying to make the in-line print statement execute so that Hello1 is printed to the screen. I want to know why, after having run the code python doesnt see "print(Hello1)" and print Hello1 to the screen.
+ 1
So if I wanted to have a string of inline code like print(print(print('hello')))
I would have to put exec infront of it?