Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (50.2k points)

My code is:

my_name = 'Zed A. Shaw'

my_age = 35 # not a lie

my_height = 74 # inches

my_weight = 180 #lbs

my_eyes = 'Blue'

my_teeth = 'White'

my_hair = 'Brown'

print(f"Let's talk about {my_name}.")

print(f"He's {my_height} inches tall.")

print(f"He's {my_weight} pounds heavy.")

print("Actually that's not too heavy.")

print(f"He's got {my_eyes} eyes and {my_hair} hair.")

print(f"His teeth are usually {my_teeth} depending on the coffee.")

When I am executing the above code, I am getting an error message:

File "/Users/permanentmajority/Desktop/Coding/learnpythonbook.py", line 75

    print(f"Let's talk about {my_name}.")

                                       ^

SyntaxError: invalid syntax

[Finished in 0.077s]

1 Answer

0 votes
by (107k points)
edited by

I believe that you are having an old version of python that is why you are getting this error. Try upgrading to the latest version of python. Please be informed that the F-string literals have been added to python after python 3.6. 

Interested in learning Python? Enroll in our Python Course!

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...