Test your understanding with 12 questions. You need 70% (9 out of 12) to pass. Good luck!
What is the key characteristic of Python strings that differs from lists?
What does "Hello World".lower() return?
"Hello World".lower()
"HELLO WORLD"
"hello world"
"Hello world"
"Hello World"
lower()
What does " hello ".strip() return?
" hello ".strip()
"hello"
" hello"
"hello "
" hello "
strip()
What does "banana".count("an") return?
"banana".count("an")
1
3
0
2
Given text = "Programming", what does text[0:4] return?
text = "Programming"
text[0:4]
"Progr"
"Prog"
"Pro"
"rogr"
How do you reverse a string in Python?
text.reverse()
reverse(text)
text[::-1]
text[-1:0]
[::-1]
reverse()
What does "hello".find("xyz") return?
"hello".find("xyz")
-1
False
find()
index()
What does "a,b,c,d".split(",") return?
"a,b,c,d".split(",")
"a b c d"
["a,b,c,d"]
("a", "b", "c", "d")
["a", "b", "c", "d"]
split(",")
What does "-".join(["2024", "03", "15"]) return?
"-".join(["2024", "03", "15"])
["2024-", "03-", "15"]
"2024-03-15"
"-2024-03-15-"
"2024", "03", "15"
join()
What does rfind() do differently from find()?
rfind()
What does the r prefix do in r"hello\nworld"?
r
r"hello\nworld"
Which is the most efficient way to build a string from many pieces in a loop?
+=
replace()
"".join(list)