title: How to sum strings of hours and minutes without the use of any date or time libraries
body: <p>I should not use any date or time libraries!  Actually I was able to sum them as normal integers but I couldn't find how to sum them as hours and minutes so as an example &quot;03:50&quot; + &quot;04:20&quot; should be &quot;08:10&quot; but actually I got &quot;7:70&quot; because I still couldn't find valid approach. Any hint or approach is much appreciated. Thank you.</p>
  <pre><code>import re
  
  def add_time(time, duration):
  
   
    elems1 = re.split(r&quot;\s&quot;, time)
    elems2 = re.split(r&quot;:&quot;, elems1[0])
    elems2.append(elems1[1])
    elems3 = re.split(r&quot;:&quot;, duration)
  
  
    resH = eval(elems2[0]) + eval(elems3[0])
    resM = eval(elems2[1]) + eval(elems3[1])
  
    
    return f'{str(resH)}:{str(resM)} {elems2[2]}'
  
  
  print(add_time(&quot;3:50 AM&quot;, &quot;4:20&quot;))
  </code></pre>
  <p>Actual output</p>
  <pre><code>7:70 AM
  </code></pre>
  <p>Desired output</p>
  <pre><code>08:10 AM
  </code></pre>