| Total Complexity | 3 |
| Total Lines | 20 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | def sun_angle(time): |
||
| 2 | hour, minute = time.split(':') |
||
| 3 | hour = int(hour) |
||
| 4 | minute = int(minute) |
||
| 5 | converted_time = (hour - 6) * 60 + minute |
||
| 6 | if converted_time < 0 or converted_time > 12 * 60: |
||
| 7 | return "I don't see the sun!" |
||
| 8 | return round(converted_time / (12 * 60) * 180, 2) |
||
| 9 | |||
| 10 | |||
| 11 | if __name__ == '__main__': |
||
| 12 | print("Example:") |
||
| 13 | print(sun_angle("07:00")) |
||
| 14 | |||
| 15 | # These "asserts" using only for self-checking |
||
| 16 | # and not necessary for auto-testing |
||
| 17 | assert sun_angle("07:00") == 15 |
||
| 18 | assert sun_angle("01:23") == "I don't see the sun!" |
||
| 19 | print("Coding complete? Click 'Check' to earn cool rewards!") |
||
| 20 |