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

25th May 2020, 5:26 PM
Matthias Seidl
8 odpowiedzi
+ 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.
25th May 2020, 5:41 PM
Lothar
Lothar - avatar
+ 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') ?
25th May 2020, 5:40 PM
Matthias Seidl
+ 1
Thanks for your quick help, Kiibo and Lothar!
25th May 2020, 5:48 PM
Matthias Seidl
0
If I use that, I get an error ("NameError: name 'random' is not defined")
25th May 2020, 5:35 PM
Matthias Seidl