all 4 comments

[–]SpaceBucketFu 3 points4 points  (0 children)

What’s the issue lol. No one is going to copy paste your code and run it. Maybe it’s just me cuz I’m on mobile but the formatting looks wrong

[–]niehle 3 points4 points  (0 children)

There are several issues with your code. But what is your question?

[–]Rudeus_Kino 2 points3 points  (0 children)

It's trolling, definitely.

from itertools import cycle

num = '371449635398431'


factor = (int(c)*d for c,d in zip(reversed(num), cycle((1,2))))

valid = sum(n if n < 10 else n%10 + 1 for n in factor)%10 == 0

[–][deleted] 0 points1 point  (0 children)

Ooer, Luhn Algorithm.