Levels Tought:
Elementary,Middle School,High School,College,University,PHD
Teaching Since: | Apr 2017 |
Last Sign in: | 11 Weeks Ago, 5 Days Ago |
Questions Answered: | 4870 |
Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
Write a program in python to compute if a given number is a valid credit card number.
Credit card numbers have what is called a check digit. This is a simple way of detecting common mis-typings of card numbers. The algorithm is as follows:
An example run might be:
Type a credit card number (just digits):Â 1
1 is not a valid credit card number
Another run might be:
Type a credit card number (just digits):Â 240
Yes, 240 is a valid credit card number
Another run might be:
Type a credit card number (just digits):Â 9548
Yes, 9548 is a valid credit card number
Another run might be:
Type a credit card number (just digits):Â 5490123456789129
5490123456789129 is not a valid credit card number