fork(1) download
  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('911016') # Affiche « 8 »
Success #stdin #stdout 0s 23352KB
stdin
Standard input is empty
stdout
6