Skip to content

Commit bc5133d

Browse files
authored
Add files via upload
1 parent 5081149 commit bc5133d

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

assets/poster/Srikanth_Time.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
if __name__ == "__main__":
2+
n=int(input())
3+
while(n>=1):
4+
t1=input()
5+
t2=input()
6+
h1,m1=[int(o) for o in t1.split(':')]
7+
h2,m2=[int(o) for o in t2.split(':')]
8+
if(h1>=24 or m1>=60 or h2>=24 or m2>=60):
9+
print("Invalid Input")
10+
else:
11+
if(h1*60 + m1 < h2*60 + m2):
12+
h1,h2=h2,h1
13+
m1,m2=m2,m1
14+
res_hour = h1-h2
15+
res_min = m1-m2
16+
if(res_min<0):
17+
res_hour-=1
18+
res_min+=60
19+
hour=str(res_hour)
20+
minute=str(res_min)
21+
if(res_hour<10):
22+
hour='0'+hour
23+
if(res_min<10):
24+
minute='0'+minute
25+
print(hour+":"+minute)
26+
n=n-1

0 commit comments

Comments
 (0)