Help with python coding (beginner)


#1

HI,
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 = datetime.now()
current_year = now.year
current_month = now.month
current_day= now.day 
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?
Thanks


#2

I ran your code here:

https://repl.it/@stetim94/RedOverdueAndalusianhorse

unable to reproduce problem


#3

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


#4

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).


#5

ok. thanks for the help!


#6

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


#7

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