Ex 2 Date and TIme


Need help with date and time ex2. Err message is coming that my variable needs to be printed

Ex 2

from datetime import datetime
now = datetime.now()

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

The message is, you have forgotten to print the variable now

The programs should run and this message should not come

Replace this line with your code.


The Instructions
01. Create a variable called now and store the result of datetime.now() in it.
02. Then, print the value of now.

What are you doing with formatting-sequences....they are not needed !!!
print now


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