aggiunge esercizio 28
This commit is contained in:
@@ -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(""))
|
||||||
Reference in New Issue
Block a user