I'm having some difficulties with my code in python. I want to create a code which will check if the number of a credit card is valid. But it keep showing me the message:
Traceback (most recent call last):File "C:\Users\George\Desktop\FRONTISTHRIAKH ASKHSH 6.py", line 14, in <module>if int(x[0][0])>4 and int(x[0][0])<7:
TypeError: 'builtin_function_or_method' object has no attribute '__getitem__'
Here is my code:
n=raw_input()
while n!="END" and n!="end":s=0x=[n]if int(x[0][0])>4 and int(x[0][0])<7:if x[0][3]==" " or x[0][3]=="-": if x[0][3]==" ":x[0].remove(" ")else:x[0].remove("-")if len(x[0])>16:print Falseelse: a=[int(x[0][0]),int(x[0][1]),int(x[0][2]),int(x[0][3]),int(x[0][4]),int(x[0][5]),int(x[0][6]),int(x[0][7]),int(x[0][8]),int(x[0][9]),int(x[0][10]),int(x[0][11]),int(x[0][12]),int(x[0][13]),int(x[0][14])]for i in range(0,14,2):a[i]=2*a[i]if a[i]/10!=0:a[i]=a[i]/10+a[i]%10for i in range(15):s=s+a[i]if s%10==0:print Trueelse:print Falseelse:if len(x[0])>16:print Falseelse:a=[int(x[0][0]),int(x[0][1]),int(x[0][2]),int(x[0][3]),int(x[0][4]),int(x[0][5]),int(x[0][6]),int(x[0][7]),int(x[0][8]),int(x[0][9]),int(x[0][10]),int(x[0][11]),int(x[0][12]),int(x[0][13]),int(x[0][14])]for i in range(0,14,2):a[i]=2*a[i]if a[i]/10!=0:a[i]=a[i]/10+a[i]%10for i in range(15):s=s+a[i]if s%10==0:print Trueelse:print Falseelse:print Falsen=raw_input