Reputation: 580
Here's my code, and the error message:
>>> message = ‘The price of this {0:s} laptop I {1:d} USD and the exchange rate is {2:4.2f} USD to 1 EUR’.format(‘Apple’, 1299, 1.23342342)
SyntaxError: invalid character in identifier
According to the book I'm following, my code is correct. I should mention that the word "The" is highlighted in pink and the words "and" "is" both show up yellow.
Upvotes: 2
Views: 81
Reputation: 5824
You're using the wrong quote characters, you need to use '
or "
.
message = 'The price of this {0:s} laptop I {1:d} USD and the exchange rate is {2:4.2f} USD to 1 EUR'.format('Apple', 1299, 1.23342342)
Upvotes: 2