Answer to Question #306625 in Python for reyad

Question #306625

Write a python program that splits a given string on a given split character. The first input is a String and the second input is the character that will be used to split the first String.



[You cannot use the built-in split function for this task]



=====================================================================



Sample Input 1:


This-is-CSE110


-



Sample Output 1:


This


is


CSE110



Explanation: The second input which is the character '-', is used to split or divide the first input String 'This-is-CSE110' into 'This', 'is' and 'CSE110' which are printed individually in separate lines.



=====================================================================



Sample Input 2:


tom@gmail,harry@yahoo,bob@gmail,mary@gmail



,



Sample Output 2:



tom@gmail



harry@yahoo



bob@gmail



mary@gmail

1
Expert's answer
2022-03-06T14:04:44-0500
string1 = input('Enter string here: ')
dl = input('Enter seperator here: ')
for i in string1.split(dl):
    print(i)

Enter string here: This-is-CSE110
Enter seperator here: -
This
is
CSE110

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS