lundi 1 juin 2020

Using Luhn's module I am having a problem with IF statements

import luhn
from luhn import *

#BIN Must Be 6-Digits Long.
def gen():
  BIN = input("Enter A BIN Number: ")
  output = []
  for number in BIN:
    output.append(number)
  output = [int(num) for num in output]
  return (output)
BIN = gen()
if BIN <6 and len(BIN) is not 8:
    print('Invalid BIN!')
else:
    print('BIN Added To Directory!')


gen()

Specifically in the 'if' part my intention is that the 'BIN' which should be an integer is less than or greater than 6 print 'invalid' else print 'added to directory'. In addition, overall what Im looking for is if the BIN is not 6 digits long or greater than 6 digits long print 'error'.

Aucun commentaire:

Enregistrer un commentaire