Question: Here is my code and the problem is that my code does not return 'None' for example 5,6,7. please help me with this problem. def

Here is my code and the problem is that my code doesnot return 'None' for example 5,6,7. please help me with this problem.Here is my code and the problem is that my code does not return 'None' for example 5,6,7. please help me with this problem.

def credit_card(card): s = str(card) m = int(s[0]) if m == 4: if s.find('4026') == 0 or s.find('417500') == 0 or s.find('4405') == 0: return 'ALPHA'  elif m == 5: tmp = int(s[0:3]) if tmp >= 500 and tmp return 'BETA'  elif m == 6: tmp = int(s[0:2]) if tmp == 62: return 'GAMMA'  elif m == 3: tmp = int(s[0:3]) if tmp >= 300 and tmp return 'OMEGA'  else: return None 

Part III: Identifying Credit Cards (3 points0 Write a function credit-card that takes an integer representing a credit card number and returns the brand of the credit card. The returned brand is given in all uppercase letters. If the card does not match any brand, the function returns None. The table below gives the details about the credit card number formats for several companies Brand of Digits Allowable Starting Digits ALPHA 16 4026, 417500, 4405 16 500-549 range of values) BETA GAMMA 16-19 (range of possible lengths) 62 OMEGA 14 300-305

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!