End of statement expected error


#1

Please when type the below code in pycharm, it gves error.
print “I’m a %s %s and taste %s.” %
error: end of statement expected.


#2

Hi @marketing77,

The three expressions in parentheses that should follow the % operator are missing.

If you are using Python 3, print is a function, and requires parentheses.

Please supply a link to the exercise, so that users are able to supply more specific advice.


#3

here is the link to the exercise…
https://www.codecademy.com/courses/learn-python/lessons/introduction-to-classes/exercises/why-use-classes?action=lesson_resume


#4

Thanks for the link.

Codecademy currently teaches Python 2. If you are porting Codecademy Python code to Python 3, then the print statements need to be updated to enclose the content to be output within parentheses. For example, this …

print "I'm a %s %s and I taste %s." % (self.color, self.name, self.flavor)

… must be updated as follows …

print("I'm a %s %s and I taste %s." % (self.color, self.name, self.flavor))

This …

print "Yep! I'm edible."

… becomes …

print("Yep! I'm edible.")

Be sure to update this line as well …

print "Don't eat me! I am super poisonous."

#5

Thanks,really appreciate the fast help.


#6