Ejemplo n.º 1
0
def multiplyListsReturnList(listA,listB):
	a = list(listA)
	b = (listB)
	s = []
	n = len(a)
	if len(b) > n:
		n = len(b)
	
	helper.prependZeros(a,n)
	helper.prependZeros(b,n)
	
	position = 0

	b.reverse()

	for i in range(n):
		partial = multiplyOne.multiplyOneListsReturnList(a,[b[i]])
		partial.reverse()
		adjustmentForBase = len(helper.numberToList(helper.listToNumber(partial))) + position
		helper.prependZeros(partial, adjustmentForBase)
		partial.reverse()
		s = addition.addListsReturnList(s,partial)
		position = position + 1

	return s
Ejemplo n.º 2
0
def addNumbersReturnNumber(a, b):
    aList = helper.numberToList(a)
    bList = helper.numberToList(b)
    sList = addListsReturnList(aList, bList)
    return helper.listToNumber(sList)
Ejemplo n.º 3
0
def addListsReturnNumber(a, b):
    sList = addListsReturnList(a, b)
    return helper.listToNumber(sList)