Starlit Daily

📚 › Python: the friendliest first language

3. Strings and f-strings

Este artículo se traducirá automáticamente. Por ahora se muestra en inglés.

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.

Ver ejemplo

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

✍️ Ahora te toca

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

← Volver al curso