Help with python coding (beginner)


So I am new to programming and need help with some code that dosnt seem to be working:
code block:

from datetime import datetime
now =
current_year = now.year
current_month = now.month
current_hour = now.hour
current_minute = now.minute
print " the year is  %s and the day is %s" %(current_year,current_day)

once I try to run this, I get an error stating:
SyntaxError: can’t assign to literal-line 3

while I understand the error I cant figure out how to solve it. Any ideas?


I ran your code here:

unable to reproduce problem


Thanks for the fast response.
For some reason id shows an error on the code academy exercise page.
any idea why?


Not sure, seen a couple of topics now on the forum which might indicate a small bug (affecting only a very small percentage of codecademy users).


ok. thanks for the help!


É se você.usas.o.format? Poderia funcionar!


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