Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
time str to minutes int to angle float (with adjustement) solution in Clear category for Sun Angle by ezebw2
def sun_angle(time):
"""
Given a time input as a string (e.g.: '00:00'),
returns the angle of the sun as a float rounded to two decimals, asuming 1m = 0.25°
"""
time = int(time[:2])*60 + int(time[3:])
if not 360 <= time <= 1080:
return "I don't see the sun!"
angle = round(time*0.25,2)-90
return angle
Aug. 12, 2020