Created
September 2, 2016 22:46
-
-
Save mirsahib/ce33d1721b8b3abc2c4e24a21e31574a 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
num = raw_input('Enter \n') | |
left = num[0:5] | |
right = num[5:] | |
left_list = ['00010','00110','01110','11110','00001','00011','00111','01111','11111'] | |
right_list = ['01000','01100','01110','01111','10000','11000','11100','11110','11111'] | |
#import pdb | |
#pdb.set_trace() | |
counter_left=0 | |
for i in range(0,len(left_list)): | |
if left==left_list[i]: | |
counter_left = (i*10)+10 | |
break | |
else: | |
counter_left = 1 | |
counter_right=0 | |
for i in range(0,len(right_list)): | |
if right==right_list[i]: | |
counter_right = (i*1)+1 | |
break | |
else: | |
counter_right = 1 | |
total = counter_right+counter_left | |
if counter_left==1 or counter_right==1: | |
print 'invalid' | |
else: | |
print total |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment