Question
Credit card numbers are 16 numbers long with spaces every four numbers (represented by s below).Order of the numbers means something specific as shown below.The
Credit card numbers are 16 numbers long with spaces every four numbers (represented by s below).Order of the numbers means something specific as shown below.The first number represents what type of card it is:4 is Visa, 5 is Discovery Card, 6 is Master Card. Routing number and credit limit is embedded.For example, the card below is a Visa with routing number 567891 and the credit limit is $3500.00.The credit limit is in hundreds of dollars.
4234s5678s9123s5362
Type
Routing Number
Credit Limit
I need a function break_up that accepts a string that represents a credit card number and returns the type of card, the routing number, and the credit limit on the card.The function must use slicing and cannot use split.
The main function will let a user enter a string representing a credit card number (including spaces) and then pass this string to function break_up.Sample input would be (notice the spaces every four characters:
Enter credit card number: 4234 5678 9123 5362
Function main will format and print the type of card, the routing number and the credit limit as follows.No extra spaces.
Visa
Routing Number:567891
Credit Limit: $3500.00
Python allows you to return multiple values from a function. For example,
def my_function(value):
x = value
y = 2
return x,y
def main():
num1, num2 = my_function(6)
print(num1)
print(num2)
You can use this idea for the break_up function.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started