def validate(n):
    def double(x):
        return (2 * x) % 10 + (1 if x >= 5 else 0)
    
    m = map(int, str(n)[::-1])
    
    d = [double(x) if i % 2 == 1 else x for i, x in enumerate(m)]
    
    return sum(d) % 10 == 0 

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: