Exemplo n.º 1
0
def product(ls, start, end):
	"""Multiplies all the numbers in the given range of the list

	Input data:
	ls -- The list
	start -- The starting point of the range
	end -- The end point of the range 
	Output data:
	The product of the numbers in the given range
	"""
	prod = ComplexNumber.create(1)
	for i in ls[start:end + 1]:
		prod = ComplexNumber.multiply(prod, i)
	return prod
def multiply():
    assert (ComplexNumber.multiply(cn(-1j), cn(1j)) == cn(1))
    assert (ComplexNumber.multiply(cn(1j), cn(1j)) == cn(-1))
    assert (ComplexNumber.multiply(cn(2 - 1j), cn(3 + 1j)) == cn(7 - 1j))