# f-strings are flexible way to do string interpolation available in Python 3.6+
# The old way with "format":
user = "Jane Doe"
action = "buy"
log_message = 'User {} has logged in and did an action {}.'.format(
user,
action
)
print(log_message)
# User Jane Doe has logged in and did an action buy.
# Instead of "format" after v3.6 we can use more flexible and readable way to do the same thing:
user = "Jane Doe"
action = "buy"
log_message = f'User {user} has logged in and did an action {action}.'
print(log_message)
# User Jane Doe has logged in and did an action buy.