Answer to Question #175184 in Python for bhuvanesh

Question #175184

Given date-time D, write a program to print the time left for the next New Year.


1
Expert's answer
2021-03-25T18:22:19-0400
import datetime

d = datetime.datetime(*[int(_) for _ in input('Input date and time (year, month, day, hours, minutes, seconds separated by space): ').split(" ")])
next_new_year = datetime.datetime(d.year + 1, 1, 1, 0, 0, 0)
delta = next_new_year - d
print("Time until next New Year: ", delta)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS