DEV Community

Discussion on: Python Script: Validating Credit Card Number - Luhn's Algorithm

Collapse
 
lucamuscat profile image
Luca Muscat

That's great! However you can optimize it a little bit and save a couple of lines by keeping the digits variable as a generator since data will be loaded lazily. You may either remove the list function wrapping the enumerate function or you can just move the enumerate function directly into the for loop (removing the need for the digits variable, I'm pretty sure this doesn't hurt readability and keeps the character limit under 80).

Collapse
 
anuragrana profile image
Anurag Rana

Thanks for the suggestions Luca. Will make changes as per your suggestion in next version.

Collapse
 
markustheuer profile image
markustheuer

The visa card generator creates a credit card by first loading a generator to the personal computer of the user. Then the user makes a choice of which credit card he wants to generate. The computer processes the data and then creates the card. Once the card has been created, the process is done.