0

[Python3]: Ask multiple inputs on the same libe

My program asks an input from the user with input(question). It continues asking until the answer is correct, but each time, it puts the question on a new line. Is it possible to write it on the same line as the one before? Thanks in advance

25th Nov 2017, 6:19 PM
Edgar Badalyan
Edgar Badalyan - avatar
3 Answers
0
Accepting multiple inputs/ values using a single input() can be achieved using the map() and split() methods suitably to extract values separated by space, coma etc. However, scenario that you have opted involves the user entering some value then 'ENTER' on the keyboard before the program executes one loop/ checks for correctness... if correct terminating and if incorrect accepting next input on that very same line... I believe the second part, i.e. if incorrect part, won't be possible as every input() in the loop would be a separate call and therefore will result in the system console reflecting the end-line/ return/ enter from the user by going to the next line.
25th Nov 2017, 6:47 PM
Anil
Anil - avatar
0
That was as far as CUI was concerned, but you are always free to use the GUI capabilities of python to control your input/output locations...
25th Nov 2017, 6:49 PM
Anil
Anil - avatar
0
Ok, thanks for your answer
25th Nov 2017, 9:31 PM
Edgar Badalyan
Edgar Badalyan - avatar