loop
Working with strings

Module 2 · Working with strings · Lesson 4 of 4

Quiz

Five questions on indexing, slicing, methods and f-strings. Work each one out before you pick.

1

What does this print?

word = "python"
print(word[1:4])
2

What happens here?

s = "hi"
s[0] = "H"
3

After this runs, what is text?

text = "Hello"
text.upper()
4

What does this print?

name = "Ada"
print(f"Hi {name}!")
5

What does this print?

print(f"{7/2:.2f}")

Strings are one of the types you'll reach for most — and now you can take them apart, reshape them, and build new text cleanly. That rounds out the data types at the heart of everyday Python.