Back to Learning Hub

Day 6: Python String Methods, F-Strings & Escape Seq

15 questions • Select the best answer for each question

Question 1

What does this code print? text = "I love Java" print(text.replace("Java", "Python"))

Question 2

What is the output? text = "apple,banana,orange" print(text.split(","))

Question 3

What does split() return?

Question 4

What will this code do? age = 25 print("Age is " + age)

Question 5

Which line correctly combines text and a number?

Question 6

Which is the best modern way to format strings?

Question 7

What will this print? name = "Alex" print(f"Hello {name}")

Question 8

What is the output? price = 12.567 print(f"{price:.1f}")

Question 9

What does \n do in a string?

Question 10

What will this print? print("Hello\nWorld")

Question 11

What does \t represent?

Question 12

What will this output? print("Path: C:\\Users\\Admin")

Question 13

What does \r do?

Question 14

Which feature is commonly used for live progress updates?

Question 15

Which statement is TRUE about f-strings?