0
What is wrong in this code, I'm getting 6,7 compilation error?
#code by sanjay kazi. def rev(z): # function to reverse string or list return z[::-1] num = str(input()) t = list(rev(num)) p = [] for l in t: p.append(int(l)) # p is inverted list of input for i in range(len(p)): if (i+1)%2==0: p[i] = p[i]*2 # multiplies every 2nd number with 2 for j in range(len(p)): if p[j] > 9: p[j] = p[j]-9 # substraction of 9 from numbers greater than 9 sum = 0 for k in p: sum = sum + k if sum % 10 == 0: print("valid") else: print("not valid")
5 Respostas
0
Hi can you please specify what are the inputs , and what are the outputs?
0
Actually its a challenge problem and 5 cases are satisfied but last two case are producing error.
0
You can find it in medium level challenge problem. "Credit card validator "
0
You should then add code coach in the tags,also reframe your question like why the last two 6 and 7 test cases are failing ,I think it's a pro question so I can't help further
0
Okay cool