-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path07_06_string_replace.py
More file actions
27 lines (24 loc) · 1.32 KB
/
07_06_string_replace.py
File metadata and controls
27 lines (24 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Replace all occurrences of the letter `m` with the symbol `_`.
# For example:
# text: more python programming please
# symbol: #
# result: #ore python progra##ing please
poem = """10
maggie and milly and molly and may
went down to the beach(to play one day)
and maggie discovered a shell that sang
so sweetly she couldn't remember her troubles,and
milly befriended a stranded star
whose rays five languid fingers were;
and molly was chased by a horrible thing
which raced sideways while blowing bubbles:and
may came home with a smooth round stone
as small as a world and as large as alone.
For whatever we lose(like a you or a me)
it's always ourselves we find in the sea"""
# Write your code below here
input="10 maggie and milly and molly and may went down to the beach(to play one day) and maggie discovered a shell that sang so sweetly she couldn't remember her troubles,and milly befriended a stranded star whose rays five languid fingers were; and molly was chased by a horrible thing which raced sideways while blowing bubbles:and may came home with a smooth round stone as small as a world and as large as alone. For whatever we lose(like a you or a me) it's always ourselves we find in the sea"
for i in range(0,len(input)):
if(input[i]=="m"):
input=input.replace('m','_')
print(input)