Public feed #727564

Unnamed

public python v1 · immutable
Raw Edit
·published 2007-10-06 04:09 UTC
rendered paste body
def verify_sin(sin):        if ( type(sin) != str ):        return False        sin = sin.replace('-', '')        if ( len(sin) != 9 ):        return False        sum_even = 0    sum_odd = 0    odd_temp = 0    for index in range(0, len(sin) - 1):        if ( index % 2 == 0 ):            sum_even += int(sin[index])        else:            odd_temp = int(sin[index]) * 2            if ( odd_temp >= 10 ):                sum_odd += int(str(odd_temp)[0]) + int(str(odd_temp)[1])            else:                sum_odd += odd_temp        total = sum_even + sum_odd    total = (total + (10 - total % 10)) - total        return str(total) == sin[-1]