Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Simple and commented solution in Clear category for Sun Angle by patryk-tech
def sun_angle(time):
sunrise = 6 * 60 ## minutes after midnight
sunset = 18 * 60
daylight = (sunset - sunrise) ## total minutes of daylight
h, m = time.split(':')
minutes = int(h) * 60 + int (m)
if minutes < sunrise or minutes > sunset:
return "I don't see the sun!"
return round((minutes - sunrise) * 180 / daylight, 2)
April 2, 2019