sun_angle   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 15
dl 0
loc 20
rs 10
c 0
b 0
f 0
wmc 3

1 Function

Rating   Name   Duplication   Size   Complexity  
A sun_angle() 0 8 3
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