Back to Learning Hub

Day 5: Python Strings Explained: Quotes, Slicing

21 questions • Select the best answer for each question

Question 1

Which line is written CORRECTLY?

Question 2

Which option correctly prints: Python's power

Question 3

Which syntax creates a multiline string?

Question 4

What will be the output? text = "Python" print(text[0])

Question 5

What does this print? text = "Python" print(text[-1])

Question 6

What will this code print? for char in "Hi": print(char)

Question 7

What is the output? word = "Hello" print(len(word))

Question 8

What will this print? text = "Hi there" print(len(text))

Question 9

What is the output? text = "Python is powerful" print("power" in text)

Question 10

Which line correctly uses single quotes inside double quotes?

Question 11

What does this code print? text = " hello " print(text.strip())

Question 12

What is the output? text = "Python" print(text[2])

Question 13

What does this print? text = "Python" print(text[-2])

Question 14

What will be printed? text = "PYTHON" print(text.lower())

Question 15

What does this code output? text = "python" print(text.upper())

Question 16

What will this print? text = "Learning Python" print(text[0:8])

Question 17

What is the output? text = "Learning Python" print(text[-6:])

Question 18

What does this code print? text = "Python is fun" print("Java" not in text)

Question 19

How many times will this loop run? for ch in "Hey": print(ch)

Question 20

What will be the output? text = " AI " print(len(text))

Question 21

What does this print? text = " AI " print(len(text.strip()))