0
Facing issue with Creadit Card problem
Card_Num = input() Card_Num_List = list(Card_Num) Card_Num_List.reverse() for j in range(len(Card_Num_List)) : Card_Num_List[j] = int(Card_Num_List[j]) sum = 0 for j in range (len(Card_Num_List )) : if j % 2 == 1: Card_Num_List[j] = Card_Num_List[j]*2 if Card_Num_List[j] > 9: Card_Num_List[j] -= 9 sum = sum + Card_Num_List[j] if sum % 10 == 0: print("valid") else : print ("not valid") I am using the python code to solve a Creadit Card problem of solo learn and still last two tests are not satisfied
2 Answers
+ 2
Mayank Joshi along with the above validations the card also needs 16 digit. So therefore you need to check length of the cards.
+ 1
Thank Aysha