0
Customize text in Input window of code playground [solved]
Hi all, I tried the following code: https://code.sololearn.com/crILkjd8p40Y/#py The input windows is supposed to show the two random numbers to add. Instead I get the standard line "Seems like your program requires input". How can I achieve this ? Thanks Matthias
8 Respostas
+ 5
Matthias, you need to convert the input (comes always as string!) to int like this:
s = int(input("Sum "+str(a)+" and "+str(b)))
But the program doesn't make sense in playground, as you have to enter all "inputs" in advance. But on a regular IDE it works properly. May be you could put it in a loop, so that a user can run 10 exercises or like this.
+ 1
Thanks. Now it works again.
Can you also help with my actual problem (input window saying 'Seems like your program requires input', but I want it to say instead 'Sum number a and number b') ?
+ 1
Thanks for your quick help, Kiibo and Lothar!
0
If I use that, I get an error ("NameError: name 'random' is not defined")