Code in sot working in python shell in the laptop(windows)


I an seeing some discrepancies between the Python codes which are provide here and the python shell for dekstop(windows). For example, if I want to print I can execute the code here without using parentheses whereas on dekstop I need to use them. However I am having hard time with this particular code at the moment called “datetime”. If I put the exact same code which is given in codecademy I am getting syntax error. What am I missing? Would anyone please delineate? I have provide the code herewith. Thanks in advance :slight_smile:


from datetime import datetime

print '%s/%s/%s %s:%s:%s' % (now.month,,now.year, now.hour,now.minute,now.second)


This isn’t completely accurate, it has to do with the different python versions, not the system running python

i am confused, you already answered your own question? In python3, print is a function call, so it requires parentheses, you say as much, but somehow you fail to realize this here?


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