Give the output of the following snippet: Name= “Split-this-string” Name.split(“-”) a. [“Split”, “this”, “string”] b. Split, this, string c. [“Split-“, “this-“, “string”] d. Split this string
Answers
Answered by
0
a. [“Split”, “this”, “string”]
Answered by
1
The output of the given code of the following snippet Name= “Split-this-string” Name.split(“-”) is [“Split”, “this”, “string”]. Here the split occurs where the separator is specified. Here in the code, the split happens when there is a separator in the string ' - '. When there is no separator specified in the code, there is no split in the text and the split shows the entire string as the output.
Similar questions
Math,
6 months ago
Math,
6 months ago
Social Sciences,
6 months ago
CBSE BOARD X,
1 year ago
Math,
1 year ago
Business Studies,
1 year ago