Given date-time D, write a program to print the time left for the next New Year.
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')
Comments
Leave a comment