+ 4
Exec() function
So the exec() function will execute a string like a mini program. Can we therefore ask the user to input an entire program. If so, how would we stop the input finishing when the user presses enter? How would the input Finnish?
5 Respuestas
+ 9
Perhaps you could make it in a while loop and concatenate until the input equals "end" for example.
Like this:
https://code.sololearn.com/cK2FvtM6qkGF/?ref=app
+ 12
Sololearn does not contain all the language interpreters/compilers in-app. Instead, for your code to "run", it sends it to a remote interpreter, which in turn executes your code and sends back the output. Since that is one session per runtime, you have to provide the whole input beforehand.
+ 5
I was going to say you could add a new line after each input for longer input but I noticed you've updated it. Thanks
+ 4
Thanks, that works but it raises another question:
Is ther any way we could put speech marks on user input to make it last multiple lines in the python shell.
It works better on the shell, but why does sololeaen ony let you make 2 lines of input? Maybe the for co fuses it?
+ 2
Thanks