Last active
August 29, 2015 14:21
-
-
Save antonshilov/69c9fbae0a713cf0dac1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print "Hello! Input format HH:MM" | |
time = str(raw_input("Time - ")) | |
splittedTime = time.split(":") | |
try: | |
splittedTime = [int(i) for i in splittedTime] | |
except ValueError: | |
print "Invalid input" | |
exit() | |
splittedTime = [int(i) for i in splittedTime] | |
if splittedTime[0] > 23 or splittedTime[1] > 59: | |
print "Invalid input" | |
exit() | |
else: | |
if int(splittedTime[0]) > 12: | |
splittedTime[0] = int(splittedTime[0]) - 12 | |
degrees = abs(splittedTime[0] * 30 - splittedTime[1] * 6) | |
if degrees == 360: | |
print 0 | |
else: | |
print degrees |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment