Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A. (If you are less comfortable with this assignment) Write a Python program that asks for a credit card number (input as a string without

image text in transcribed
image text in transcribed
A. (If you are less comfortable with this assignment) Write a Python program that asks for a credit card number (input as a string without hyphens or spaces, not as a number), and reports the card type (American Express, MasterCard, or Visa), and whether the card is valid. So, for the example above (4735672384163216), your program should output "4735672384163216----- ---VISA: VALID", i.e., the number as a string, 8 hyphens, and "VISA: VALID." If the entered number is anything other than a valid CC number, your program should output the number as a string, eight hyphens, and "INVALID NUMBER." In addition to your working code, you should submit a plain text file with one answer per line, for each of the following twenty CC numbers (which include valid and invalid credit card numbers of each type): 4735672384163216 5125131221485655 5451115051163662 349232661988728 4464766795523282 5549984527236360 341714386384157 5365926823264290 5213376389751262 375313685074727 5386622283419322 4225298661212573 5528322935717637 5420050412758076 5345677634360280 4581275409198311 4126427705118053 377734275639344 5141463348206102 5236758703360477 You may manually enter these numbers one at a time, or (better) read them from a file that you create. B. (If you are more comfortable with this assignment) Write a Python program that reads a text file of candidate CC numbers, one number (as a string) per line, and outputs a file with the results described above for each CC number, one per line. The CC numbers the file (of about 700 numbers) may be of any type in any order. Test your program on the file, testCCNums.txt and submit the results with your working code

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Solaris 11.2 System Administration (oracle Press)

Authors: Harry Foxwell

1st Edition

007184421X, 9780071844215

Students also viewed these Databases questions