pastebin

Paste Search Dynamic
Recent pastes
cleDeControle
  1. def cleDeControle(chars):
  2.         factor = [7, 3, 1]
  3.         result = 0
  4.  
  5.         for index, char in enumerate(chars.upper()):
  6.                 if char == '<':
  7.                         char = 0
  8.                 elif char >= 'A' and char <= 'Z':
  9.                         char = ord(char) - 55
  10.                 else:
  11.                         char = int(char)
  12.  
  13.                 result += char * factor[index % 3]
  14.  
  15.         return result % 10
  16.  
  17. print cleDeControle('IDFRAMANTTE<<<<<<<<<<<<<<<<<<<3321041902332107084CHRISTOPHE<<<<8506014M')
Parsed in 0.008 seconds