Information, calcul, communication
CS-119(k)
ICC-P Code pour exercice 4
This page is part of the content downloaded from ICC-P Code pour exercice 4 on Sunday, 29 June 2025, 20:43. Note that some content and any files larger than 50 MB are not downloaded.
Page content
Code:
def show_word(word: str) -> None:
print(f"Mot: '{word}'")
my_string = "This is fun!"
last_space_position: int = -1
next_space: int = my_string.find(" ")
while next_space != -1:
word: str = my_string[last_space_position + 1 : next_space]
show_word(word)
last_space_position = next_space
next_space = my_string.find(" ", last_space_position + 1)
last_word: str = my_string[last_space_position + 1 :]
show_word(last_word)