Invalid syntax error with pycharm


#1



https://www.codecademy.com/en/courses/python-beginner-en-zFPOx/0/4?curriculum_id=4f89dab3d788890003000096


print '%s/%s/%s' % (now.day, now.month, now.year)
^
SyntaxError: invalid syntax

Process finished with exit code 1


I try to reviewing with pycharm but error show up. even i copy all code from code in codecademy.
what am i doing resolve it?


from datetime import datetime
now = datetime.now()

print '%s/%s/%s' % (now.day, now.month, now.year)

#2

If your environment is Python 3.x.x then use print() since it is a function.


#3

Thanks! It work after add parenthesis :slight_smile:


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.