+ 11
PlayGround - User Input before Output ? đ€€
When we write code with user input, it's nice to prompt some info (e.g. "please enter your name", "enter a number", etc..) đ Some times we need two arguments...đ€ Why Code PlayGround does not show output before asking for input ? đ€ https://code.sololearn.com/coRmj6QQr3hH/?ref=app
7 Respostas
+ 39
This is an old problem. Alas it hasn't been solved yet, Sonic. But the good news is there are ways to overcome it.
USERS can provide all the information at once, separate the values with new lines. Obviously they have to know what input type and the number of the values (lines) are expected.
YOU should provide simple and CLEAR instructions on how users should input data in the comments of your codes. Also remember the order of values in code.
For example:
/* This program requires your NAME, your AGE and your favorite MOVIE.
1. When prompted, enter your name on the first line and press return on your keyboard to make a new line.
2. Enter your age on the second line and press return.
3. Enter your favorite movie and press "submit".
*/
The message above can be displayed in case of wrong user input.
+ 8
tejaswi kanneganti đż how can i pass command line arguments (at playground) ?
+ 7
The playground is not interactive.
You need to give all inputs before you run the code
However it is not impossible
just enter
a line in the input box and you will see the results
https://code.sololearn.com/cY9KBVId9FdG
In this code (it is c#, sorry no java)
I show how you can make a value input script, to be able to explore coding.
Also consider using hard-coded values in the playground.
+ 6
because the program running in SL server, so we cant interact with it direcly
+ 6
Could code playground be improved at all one day to send more than a single request to the server for interactive programs?
+ 4
Why can't you try command line arguments