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.
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)
Comments
Leave a comment