Answer to Question #306296 in Python for Ariful

Question #306296

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.


1
Expert's answer
2022-03-05T04:11:45-0500
sentence = 'This is a sentence'
split_value = []
tmp = ''
for c in sentence:
    if c == ' ':
        split_value.append(tmp)
        tmp = ''
    else:
        tmp += c
if tmp:
    split_value.append(tmp)

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