aggiunge esercizio 28

This commit is contained in:
2026-04-09 09:05:37 +02:00
parent d719078b72
commit b838d9bb42
+20
View File
@@ -0,0 +1,20 @@
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(""))