+ 4
Is it possible to use pythons input() in Code Playground?
6 Antworten
+ 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)
+ 3
how would you code a quiz then?
+ 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.
+ 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
+ 1
with a proper ide. on android you would use QPYTHON3 and on computer use an ide of your choice
+ 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