Choice selection | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Choice selection

I want some amount of choices to be displayed to the user and I want them to select one of those... I tried using input,But I can't get the choices displayed before the input.Its always asking for input and then after giving the input ,it shows the choices and what I have selected.How to rectify this?

15th Jun 2018, 5:09 PM
Vivek M R
Vivek M R - avatar
4 Answers
+ 8
Thank you for sharing your code Vivek M R. I know what you mean now 👍 Unfortunately, that's the way online compilers work, you need to send the inputs first to the server so it can compile the whole code and throw the result. Only web codes will let you display the choices before gathering any input. What I've done and several other sololearners is write the instructions as a comment on the first lines of the code, so people can read them before running the code and enter as input whatever they are supposed to😊 Also please note that if your code requires multiple inputs, you will have to separate them by pressing the Enter key.
17th Jun 2018, 1:36 AM
Pao
Pao - avatar
+ 8
Could you please share your code? 😊
15th Jun 2018, 10:06 PM
Pao
Pao - avatar
16th Jun 2018, 2:36 AM
Vivek M R
Vivek M R - avatar
+ 1
Here it is! I'm trying to make a simple calc
16th Jun 2018, 2:36 AM
Vivek M R
Vivek M R - avatar