{
 "metadata": {
  "name": "",
  "signature": "sha256:e727329af75cb46ac094426c63b74ff6051dea9a3b4b4d30576fced0199cf432"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def multiplifier(*user_input):\n",
      "    product = 1 # Identity property, any number of things times 0 is 0\n",
      "    for term in user_input:\n",
      "        print \"%d * %d\" % (product, term)\n",
      "        product *= term # multiply the accumulator value by a term and store\n",
      "    return product"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 29
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "multiplifier(1, 2, 3, 4)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "metadata": {},
       "output_type": "pyout",
       "prompt_number": 9,
       "text": [
        "24"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def factorialize(factor):\n",
      "    return multiplifier(*list(range(1, factor+1))[::-1])"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 33
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "factorialize(5)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "1 * 5\n",
        "5 * 4\n",
        "20 * 3\n",
        "60 * 2\n",
        "120 * 1\n"
       ]
      },
      {
       "metadata": {},
       "output_type": "pyout",
       "prompt_number": 34,
       "text": [
        "120"
       ]
      }
     ],
     "prompt_number": 34
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}