datacamp-light
datacamp-light copied to clipboard
input() function is not working
I have added the input() function but it shows error in the shell
https://python-tricks.com/control-statements-in-python/
I encountered the same issue and made a workaround:
<code data-type="pre-exercise-code">
import sys
from io import StringIO
sys.stdin = StringIO("input\n")
del sys
</code>
Now the standart input has the string "input" hardcoded inside; it's not great, but it works. You can write it in the pre-exercise-code section, if you are configuratin' the exercise; or at the beginning of your python code, if you don't have the acess to the file itself.
anyone got it working?