F-String Format in Python
Level 249 keystrokes
This uses an f-string to embed variables in text, printing 'Alice is 25'. F-strings allow easy string formatting.
Python code
# Assign a string value to the variable name1name = "Alice"# Assign an integer value to the variable age2age = 25# f-strings start with f before the quotes# Variables inside {} are replaced with their values# {name} becomes "Alice" and {age} becomes "25"3print(f"{name} is {age}")Output
Alice is 25
Practice typing this code. Results are not recorded in the rankings.
Symbols in this code
The symbols you type in this Python code and how often they appear.
"× 4{× 2}× 2=× 2(× 1)× 1