Answer to Question #231260 in Python for bhuvana

Question #231260

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


1
Expert's answer
2021-09-03T15:18:19-0400
from datetime import datetime


line = input()
D = datetime.strptime(line, '%b %d %Y %I:%M %p') 
NY = datetime(D.year+1, 1, 1)
dt = NY - D
h = dt.days*24 + dt.seconds//3600
m = (dt.seconds // 60) % 60
print(h, 'houres',m,' minutes')

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