Python Python Basics (2015) Python Data Types String Formatting

subject= "Tree house loves {}".format("name") does anyone know why this won't work?!!

Subject= "Tree house loves {}".format("name")

strings.py
name= 'Olivia'
subject= "Tree house loves {}".format("name")

1 Answer

Robert Ionut Muraru
Robert Ionut Muraru
5,259 Points

Hello Olivia,

Try:

name= 'Olivia'
subject= "Tree house loves {}".format(name)

You are using "name" which makes the script see name as a string and not the variable you want to use.