PY
py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
'''
CHALLENGE: Counting And Display Strings
Write a program that captures a string that can contain spaces and displays each word in the string, the separator being the space.
Example, for the input: "I think so I am"
The program displays:
word 1: I
word 2: think
word 3: so
word 4: I
word 5: am
And finally it shows how many words the sentence has.
Good luck.
'''
string=input();string=string.split()
for index in range(len(string)):
print('Word',index+1,':',string[index])
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run