So I am on pset6 trying to implement the credit card check.
I've already completed working through the numbers and am not having any issue with the actual algorithm.
But for some reason my if statements logic doesn't work.
if ((foo)%10 == 0):
a = True
else:
a = False
print(r[0])
print(r[1])
if (a == True and r[0] == 4):
print("VISA")
elif(a == True and r[0] == 3 and r[1] == 4 or 7):
print("AMEX")
elif(a == True and r[0] == 5 and r[1] == 1 or 2 or 3 or 4 or 5):
print("MASTERCARD")
Even though I've set the logic up to only recognize as a Amex if r[0]
is 3
and r[1]
is 4
or 7
. It still shows up as an AMEX. I have also printed out r[0]
and r[1]
so I can show you that the values within that index are correct.
I don't understand how this can ignore my logic statements and print anyway. Please help me understand what I have done incorrectly. Thank you for your time.