Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Walrus :) solution in Creative category for Lightbulb Start Watching by suic
from datetime import datetime
from typing import List, Optional
def sum_light(els: List[datetime], start_watching: Optional[datetime] = None) -> int:
return sum(
d
for d1, d2 in zip(*[iter(els)] * 2)
if (d := (d2 - max(d1, start_watching or d1)).total_seconds()) > 0
)
Nov. 12, 2020
Comments: