+ 4

Is it possible to use pythons input() in Code Playground?

27th Feb 2017, 7:24 PM
Oma Falk
Oma Falk - avatar
6 Respostas
+ 5
Yes, but when you need more than one input the code Playground will only ask you once, and without showing anything else (with one too), like if you wanted to do a calculator when the user runs it he has to write the operation and numbers all at once (the different inputs are separated pressing enter and writing each in a different line)
27th Feb 2017, 7:37 PM
C.E.
C.E. - avatar
+ 3
how would you code a quiz then?
27th Feb 2017, 8:07 PM
Oma Falk
Oma Falk - avatar
+ 2
Yes, but it doesn't work as you would expect. When you run you script the playground environment says that it sees that you require input and presents you a text box, however you do not get the prompt that you programmed, just an empty box. once you enter your input the script will run.
27th Feb 2017, 7:27 PM
Nathaniel Triplett
Nathaniel Triplett - avatar
+ 1
if you need to input more than 1 thing at the beginning you can input 1 thing then press return and input another and so on, but once you run the program it will throw an error when it gets to other inputs
27th Feb 2017, 7:31 PM
LordHill
LordHill - avatar
+ 1
with a proper ide. on android you would use QPYTHON3 and on computer use an ide of your choice
27th Feb 2017, 8:12 PM
LordHill
LordHill - avatar
+ 1
I saw someones code last week that was asking for input on two lines, They had commented instructions at start of code to tell user about the inputs, which I thought was a good way of getting round instructing user input, but also handy that it's possible to give multiple inputs. Frustratingly I can't remember who's code it was, I think one of the popular ones, but a quiz would be possible, commenting the questions I just tried something in the playground, just put input on seperate lines: a=input() b=input() will expect two inputs on two lines oma, i posted the code I just did, feel free to use it and build on, i called it simple math quiz, you could easily add a counter
28th Feb 2017, 12:43 AM
tracy
tracy - avatar