Is it possible that the code playground doesn't work properly? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Is it possible that the code playground doesn't work properly?

On a multiple inputs it returns just one arg in the list https://code.sololearn.com/cfBvbodJq5V6/?ref=app

22nd May 2020, 7:28 PM
Mario Leofreddi
Mario Leofreddi - avatar
23 Answers
+ 3
You don't have multiple inputs in your code.... Your input() returns a string which you then split() (by spaces) and returns a list. Just input "1 2 3 4" (without the quotes)....outputs as expected.
22nd May 2020, 8:02 PM
rodwynnejones
rodwynnejones - avatar
+ 2
Sometimes happens.
24th May 2020, 4:42 AM
Sonic
Sonic - avatar
+ 1
Giving input like 1234 and calling the split() on it will return a list ['1234'] because the split by default uses a space separator. In order to get a list you must either give inputs like rodwynnejones mentioned or you can do- x = input() print(list(x))
22nd May 2020, 8:12 PM
Avinesh
Avinesh - avatar
+ 1
Sorry, i use the translator of google to translate pags and the ask is... somewhat different
22nd May 2020, 8:30 PM
4lx
4lx - avatar
+ 1
In one word your answer is "Yes" few days ago I also faced this problem
23rd May 2020, 9:53 PM
Tarun Gautam
Tarun Gautam - avatar
+ 1
Mario Leofreddi also i would like to say that, input at this platform little bit different,you should enter one time aaaaaall inputs whitch will be used in program
24th May 2020, 8:16 PM
george
george - avatar
0
"input()" only take one input, if you want to take more inputs write more "input()" or use a loop (for, while)
22nd May 2020, 7:31 PM
4lx
4lx - avatar
0
Sorry, but .split() wasn't to pass several args to a list? If I repeat the same code on other codeplayground, they give me a list as I expect
22nd May 2020, 7:35 PM
Mario Leofreddi
Mario Leofreddi - avatar
0
What's your input like?
22nd May 2020, 7:42 PM
Avinesh
Avinesh - avatar
0
I×Am×Idiot for instance, I just tried on pydroid 3 and I got x = [1, 2, 3, 4]
22nd May 2020, 7:48 PM
Mario Leofreddi
Mario Leofreddi - avatar
0
Avinesh x = input().split() Print(x) on several inputs I receive in list x only one value
22nd May 2020, 7:50 PM
Mario Leofreddi
Mario Leofreddi - avatar
0
If you try the code in pydroid and the output is [1,2,3,4], pydroid have bugs lol
22nd May 2020, 8:07 PM
4lx
4lx - avatar
0
U can use this: x=[] while True: x.append(input()) print(x)
22nd May 2020, 8:10 PM
4lx
4lx - avatar
0
rodwynnejones I agree and I write what you say but in code playground I receive just one value in the list (e.g. 1 2 3 4 => [1])
22nd May 2020, 8:12 PM
Mario Leofreddi
Mario Leofreddi - avatar
0
What I do. I agree with you all but I get in return just one value. Nevermind. I'll do as I×Am×Idiot suggest. Thank you
22nd May 2020, 8:16 PM
Mario Leofreddi
Mario Leofreddi - avatar
0
The code of Avenish only works in one input, example: x=input() //in this example the input is 1234 print(list(x)) The output is: ["1","2","3","4"] But if you try to write more inputs or numbers of more digits is useless
22nd May 2020, 8:22 PM
4lx
4lx - avatar
0
@I×Am×Idiot .....and that is why Avinesh asked.... "What's your input like?"
22nd May 2020, 8:25 PM
rodwynnejones
rodwynnejones - avatar
0
For some reason, the question is "What is your opinion?" lol
22nd May 2020, 8:31 PM
4lx
4lx - avatar
0
I×Am×Idiot no problem. Thanks For me there is a bug in code playground also considering that in challenges it works properly
22nd May 2020, 8:44 PM
Mario Leofreddi
Mario Leofreddi - avatar
0
Challenges? You mean code coach?
22nd May 2020, 9:23 PM
4lx
4lx - avatar