Sep-06-2018, 11:03 AM
I'm a noob doing an introductory lesson on format strings. The example given in the lesson keeps giving an error, even when I directly copy/paste. Here's the code:
my_height = 80 print(f"He's {my_height} inches tall.")The error I get says this:
Error: File "/home/main.py", line 9
print(f"He's {my_height} inches tall.")
^
SyntaxError: invalid syntax
I looked for some examples online and was able to make it work like this:my_height = 80 print("He's {} inches tall.".format(my_height))So what's wrong with the syntax in the lesson I was using? Is the example in the lesson totally wrong?