Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
quest grinding solution in Uncategorized category for Sun Angle by Bifftastic
from typing import Union
from datetime import datetime as dt
def sun_angle(time: str) -> Union[float, str]:
dawn = 0
dusk = 180
hour_degree = 15
min_degree = .25
hour, minute = dt.strptime(time, "%H:%M").hour, dt.strptime(time, "%H:%M").minute
if hour < 6:
return "I don't see the sun!"
degrees = (hour - 6) * hour_degree + (minute * min_degree)
return degrees if dawn <= degrees <= dusk else "I don't see the sun!"
print("Example:")
print(sun_angle("07:00"))
assert sun_angle("07:00") == 15
assert sun_angle("12:15") == 93.75
print("The mission is done! Click 'Check Solution' to earn rewards!")
April 25, 2024
Comments: