Starlit Daily

📚 › Python: the friendliest first language

3. Strings and f-strings

Strings can be joined with +, repeated with *, and measured with len(). An f-string puts values inside text: write an f before the quote and put the variable in braces, as in f"Hi {name}".

f-strings are the easiest way to mix text and numbers.

Show example

name = "Rahim"
score = 42
print(f"{name} scored {score} points")

✍️ Your turn

Let city = "Sylhet". Print: I live in Sylhet.

← Back to course