Coding Quiz - Splitting Strings
In this coding quiz, you will write a function that uses Python's split method to separate and process a string.
Create a program that accepts a single string and a delimiter (the character used to split the string) from the user, divides the string based on the delimiter, and returns the result as a list.
Parameter Format
def solution(text, delimiter): return # Write your code here
Constraints
-
The input string can contain spaces, special characters, numbers, and alphabets.
-
The delimiter can be a string of one or more characters.
Input and Output Example
-
Input: string -
"hello,world,python", delimiter -"," -
Output:
["hello", "world", "python"]
Lecture
AI Tutor
Design
Upload
Notes
Favorites
Help