ספרת ביקורת: הבדלים בין גרסאות

נוספו 6 בתים ,  לפני שנתיים
def idChecker(ID):
import numpy#initialization
weights = [1,2,1,2,1,2,1,2]#initialization
ID_array = [int(digit) for digit in ID]#formatting
ID_Vector = numpy.array(ID_array[:-1])#formatting
elementwise_mul = weights*ID_Vector#Actual Algorithm
weights = [1,2,1,2,1,2,1,2]#initialization
piecewise_mulValidation_Digit = weights*ID_Vector10-sum(elementwise_mul%10+(elementwise_mul>10))%10#Actual Algorithm
Validation_Digit = 10-sum(piecewise_mul%10+(piecewise_mul>10))%10#Actual Algorithm
return Validation_Digit-ID_array[-1] == 0
</syntaxhighlight>
7

עריכות