Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Lightbulb Intro by dx2-66
from datetime import datetime
from typing import List
def sum_light(els: List[datetime]) -> int:
"""
how long the light bulb has been turned on
"""
sec = 0
for date1, date2 in zip(els[::2], els[1::2]):
sec += (date2-date1).total_seconds()
return sec
Dec. 28, 2021
Comments: