solution to series_product.py