title: Code giving wrong output despite clearly defining the conditions
body: <p>The question was
  <strong>Use Luhn's Algorithm to check if a credit card number is valid or not. If it is valid then print whether the card is VISA, MASTERCARD or AMERICAN EXPRESS.    (Go to your preferred search engine for any reference regarding Luhn's Algorithm or anything else)    Sample Test Case : Input: 4003600000000014</strong></p>
  <p>and the code below for it -&gt;</p>
  <pre><code>    n= str(n)
      a=0
      for i in range(0,len(n)):
          if i%2==0:
              a=a+int(n[i])
          else:
              x=int(n[i])*2
              x=str(x)
              for i in range(0,2):
                  a=a+int(i)
      b= n+ str(a)
      b= int(n)
      return b
  n= input(&quot;Enter your credit card number (without spaces)  :&quot;)
  x= luhn(n)
  l= len(n)
  if str(x)==str(n):
      if (int(n[0:2])==34 or 37) and (l==15):
          print(&quot;American Express&quot;)
      elif (int(n[0:2])==51 or 55) and (l==16):
          print(&quot;MasterCard&quot;)
      elif (int(n[0:2])==36 or 38) or (int(n[0:3])==300 or 305) and (l==14):
          print(&quot;Diners Club and Carte Blanche&quot;)
      elif (int(n[0])==4) and (l==13 or 16):
          print(&quot;Visa&quot;)
      elif (int(n[0:4])==6011) and (l==16):
          print(&quot;Discover&quot;)
      elif (l==15) and (int(n[0:4])==2123 or 1800):
          print(&quot;JCB&quot;)
      elif (l==16) and (int(n[0])==3):
          print(&quot;JCB&quot;)
      else:
          print(&quot;Invalid Card&quot;)
  else:
      print(&quot;Invalid Card&quot;)
  </code></pre>
  <p>I clearly defined the condition for each card but for the test case given above, it is giving the output MASTERCARD and I am not able to understand why, The condition for Mastercard is nowhere close to the condition for Visa, it doesnt even start with 4, yet its giving the output Mastercard (the output for the function is correct, checked it already)</p>
  <p>My source for the algorithm in case anyone asks-
  <a href="https://www.ibm.com/docs/en/order-management-sw/9.3.0?topic=cpms-handling-credit-cards" rel="nofollow noreferrer">https://www.ibm.com/docs/en/order-management-sw/9.3.0?topic=cpms-handling-credit-cards</a></p>