I am new to python and trying to append characters of a card number to two different arrays. 4003600000000014
every other digit, starting with the number’s second-to-last digit so the first digit is 1(that is left of the 4) and by jumping one number going all the way to the 0. After that, numbers that did NOT appended to the first array (mbt) should be appended to the 2nd array(normal).
mbt should be like = 4 0 6 0 0 0 0 1 normal should be like = 0 3 0 0 0 0 0 4 (two arrays combined will be again equal to 4003600000000014)
import math
def digitnumber(n):
if n > 0:
digits = int(math.log10(n)) + 1
return digits
def isvalid(n, mbt=[], normal=[]):
cardnumber = 4003600000000014
dnumber = digitnumber(4003600000000014)
n = dnumber - 1,
mbt = []
while 1 <= n < dnumber:
x = int(cardnumber / pow(10, n) % 10)
mbt.append(x)
n -= 2
n = dnumber - 2
normal = []
while 1 <= n < dnumber:
x = int(cardnumber / pow(10, n) % 10)
normal.append(x)
n -= 2
def main():
mbt = []
normal = []
isvalid(4003600000000014, mbt=[], normal=[])
print(len(mbt))
main()