{ "metadata": { "name": "", "signature": "sha256:75d038e31bd2e5365036864973f70bb4782ec07b93b075948152e32646c9f71e" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "code", "collapsed": false, "input": [ "import numpy as np\n", "import time\n", "start = time.time()\n", "\n", "for a in range(1,500):\n", " for b in range(a,500):\n", " c = np.sqrt(a**2 + b**2)\n", " if a+b+c == 1000:\n", " print \"Answer:{}\".format( a*b*c )\n", " \n", "print \"Elapsed time:{0} seconds\".format(time.time()-start)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Answer:31875000.0\n", "Elapsed time:0.388831853867 seconds" ] }, { "output_type": "stream", "stream": "stdout", "text": [ "\n" ] } ], "prompt_number": 1 }, { "cell_type": "code", "collapsed": false, "input": [], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 1 }, { "cell_type": "code", "collapsed": false, "input": [], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 1 } ], "metadata": {} } ] }