def verify_sin(sin_num):
''' This function will take in the user's sin number as paramter and check
if the sin number is valid. If it is valid it will return true, otherwise
it will return false'''
def add_input(odds):
return sum(int (v) for v in odds)
#code is doing well so far...
sin_num = sin_num.replace ("-","")
evens = add_input(sin_num[0:-1:2])
odds_1 = [v for v in sin_num [1::2] if v < 5]
odds_2 = [v for v in sin_num [1::2] if v >= 5]
total = add_input(odds_1)*2 + sum(add_input(str(int(y)*2)) for y in odds_2)\
+ evens
checksum_round = int(round (total,-1) + 10)
if (checksum_round - total) == sin_num[-1]:
return True
else:
print checksum_round
print total
print (checksum_round - total)
print sin_num[-1]
return False
sin_num = str(raw_input("Please Enter your sin number: "))
print verify_sin(sin_num)
#use 046-454-286 as sin number (note: it should return true)