alien_o = {"Colour" : "Green"}
print(f"The colour is now {alien_o["Colour"]}.")
What's wrong with these lines of code? The closing bracket and the curly bracket is affected by the quotes, and I don't understand why.
alien_o = {"Colour" : "Green"}
print(f"The colour is now {alien_o["Colour"]}.")
What's wrong with these lines of code? The closing bracket and the curly bracket is affected by the quotes, and I don't understand why.
It mixes up the "
, try using 'Colour'
instead of "Colour"
.
Because it thinks that the format string is f"The colour is now {alien_o["
, which is not what you want.