We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dd45619 commit 1a9bfc0Copy full SHA for 1a9bfc0
ch04-strings-and-string-methods/8-find-a-string-in-a-string.py
@@ -8,11 +8,13 @@
8
9
10
# Exercise 2
11
-# Try to find a number inside a string;
12
-# use str() to convert the number first
13
-version = "version 2.0"
14
-v_num = 2.0
15
-print(version.find(str(v_num)))
+# Replace every occurrence of the character `"s"`
+# with the character `"x"`
+phrase = "Somebody said something to Samantha."
+phrase = phrase.replace("s", "x")
+print(phrase)
16
+# NOTE: This leaves the capital "S" unchanged, so the
17
+# output will be "Somebody xaid xomething to Samantha."
18
19
20
# Exercise 3
0 commit comments