+ 1
I am new to this app can anyone help me to know what does "split your code" msg by sololearn means while running python code?
3 Respostas
+ 4
In some cases our programm needs to have access to individual words from a string.
To get this access we have to split the string by defining the character that should be used as a separator. We can use the string method split().
Valid separators can be a space, a comma or any other character that makes sense. The result of applying split() to a string is a list of strings. These strings can now iterated over in a loop.
Sample:
"This is Python".split() => result will be: ["This", "is", "Python"]
+ 2
That actually telling you to split your input value to multiple lines, in case you are using multiple input statements in your code, as sololearn will not show you multiple input dialog, so sololearn tell you that you must insert the value for all your code inputs in single input separated by newline
So suppose we have this simple code
a=input()
b=input()
print('welcome',a,b)
Actually in real world and real environment we will see multiple terminal input lines , where each input line is for one of these variables, but when using sololearn we must insert the following in the input dialog
First value
Second value
And sololearn will now that first line is the value of a and the second line is the value of b
I hope that you get it now 😃
+ 1
Thanks for the explanation buddy.