Advertisement
STANAANDREY

ex8 lab1 LSD

Sep 30th, 2022
746
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.35 KB | None | 0 0
  1. def sec_diff(a, b):
  2.     getIntData = lambda str: (int(str[:2]), int(str[5:7]), int(str[10:12]))
  3.  
  4.     h1, m1, s1 = getIntData(a)
  5.     h2, m2, s2 = getIntData(b)
  6.  
  7.     total1 = h1 * 60 * 60 + m1 * 60 + s1
  8.     total2 = h2 * 60 * 60 + m2 * 60 + s2
  9.     return total2 - total1
  10.  
  11. if __name__ == "__main__":
  12.     print(sec_diff('11 : 22 : 33', '11 : 22 : 35'))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement