How do I put a variable’s value inside a string (interpolate it into the string)?

In Python, you can use the format() method or f-strings (available in Python 3.6 and above) to interpolate a variable's value into a string.

Using the format() method:

name = "John"
print("My name is {}".format(name))

Watch a course Python - The Practical Guide

Using f-strings (Python 3.6 and above):

name = "John"
print(f"My name is {name}")

Both will output "My name is John".