Files
corso-python/lab28.py
T
2026-04-09 09:05:37 +02:00

21 lines
460 B
Python

def mysplit(string):
words = []
word = ""
for char in string:
if char != " ":
word += char
else:
if word:
words.append(word)
word = ""
if word:
words.append(word)
return words
print(mysplit("To be or not to be, that is the question"))
print(mysplit("To be or not to be,that is the question"))
print(mysplit(" "))
print(mysplit(" abc "))
print(mysplit(""))