Skip to content

Commit 5b0c95e

Browse files
committed
By Zhao Kun Peng
1 parent 39a388e commit 5b0c95e

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

checkio/sun_angle.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
def sun_angle(time):
2+
s=time.split(":")
3+
a=int(s[0])*60+int(s[1])
4+
if a>(18*60) or a<(6*60):
5+
return "I don't see the sun!"
6+
else:
7+
angle=(a-6*60)*0.25
8+
return angle
9+
10+
if __name__ == '__main__':
11+
print("Example:")
12+
print(sun_angle("07:00"))
13+
14+
#These "asserts" using only for self-checking and not necessary for auto-testing
15+
assert sun_angle("07:00") == 15
16+
assert sun_angle("01:23") == "I don't see the sun!"
17+
print("Coding complete? Click 'Check' to earn cool rewards!")

0 commit comments

Comments
 (0)