0

Is there any way of showing user expected input in codeplayground?

Hello, can I somehow show the user the expected input without looking on the code? It's really annoying that I have to go through the code to find the count of inputs and also what should I write on each line. On the web there are at least the input tags with labels or placeholders, and the prompt() function/method is working good, you just pass a an argument. But there are tons of others like scanners, readlines, inputs, cins, scanfs and more, that have that weird inputs. I looked through the search bar and the only thing that I found, was "Experienced Sololearners know how to deal with it :)" Any ideas?

29th Jul 2020, 8:03 AM
Qui-Gon Jinn
Qui-Gon Jinn - avatar
5 Respostas
+ 1
You could place a alert box telling user what to enter before asking for input
29th Jul 2020, 8:08 AM
Abhay
Abhay - avatar
+ 1
Qui-Gon Jinn I thought you were talking about js ,but anyway you could also use prompt("enter your name ") in js Also you can mention the language name in tags
29th Jul 2020, 8:11 AM
Abhay
Abhay - avatar
0
In Python, I will check if the user input meet some predefined criteria, for example... inp=input("What's your age?") inp=inp if inp.isdigit() else 18 # 18 is the default value if user typed something wrong To handle how many input() presented, you can try exception handling, for example... try: inp=input("What's your age?) assert inp.isdigit() except: inp=18 Or you may want to tell the user what to input... inp=input("What's your age?) assert inp.isdigit(), "Please enter your age" I wrote it in Python, since I am familiar with it, and I think you can find something similar in other languages such as JS.
29th Jul 2020, 8:12 AM
Panko
Panko - avatar
0
Panko I thought this will work, but no, there's just "split your input into separate lines" In most of other languages you can't pass string to input, you just have to print it into the console, and then type the input.
29th Jul 2020, 8:21 AM
Qui-Gon Jinn
Qui-Gon Jinn - avatar
0
Qui-Gon Jinn Yes, that is because input() in Python or prompt() in JS are actually interactive, but it is not true in SL playground, and thus users should type all of the required input at the beginning.
29th Jul 2020, 8:26 AM
Panko
Panko - avatar