-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathAssignment3_4.py
More file actions
21 lines (16 loc) · 773 Bytes
/
Copy pathAssignment3_4.py
File metadata and controls
21 lines (16 loc) · 773 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
'''
Created on 15.5.2015
A program, which finds all the indexes of word 'flower' in the following text:
"A flower is a beautiful plant, which can be planted in the garden or used to decorate
home. One might like a flower for its colors and the other might like a flower for its
smell. A flower typically symbolizes soft feelings".
@author: e1201757
'''
text = 'A flower is a beautiful plant, which can be planted in the garden or used to decorate home. One might like a flower for its colors and the other might like a flower for its smell. A flower typically symbolizes soft feelings'
index = 0
while index < len(text):
index = text.find('flower', index)
if index == -1:
break
print(index)
index += 6