Jump to content

Luhn test of credit card numbers: Difference between revisions

→‎{{header|Python}}: Link divmof to its documentation
(→‎{{header|Python}}: Link divmof to its documentation)
Line 1,490:
 
=={{header|Python}}==
The [http://docs.python.org/py3k/library/functions.html#divmod divmod] in the function below conveniently splits a number into its two digits ready for summing:
<lang python>>>> def luhn(n):
r = [int(ch) for ch in str(n)][::-1]
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.