From 86a1463df39ee51ea50bf8c586156cf74747ffe4 Mon Sep 17 00:00:00 2001 From: Donne Martin Date: Sun, 25 Jan 2015 12:44:19 -0500 Subject: [PATCH] Added reversed snippet. --- core/structs.ipynb | 42 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/core/structs.ipynb b/core/structs.ipynb index ed5c710..3c24bb4 100644 --- a/core/structs.ipynb +++ b/core/structs.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:1b00dc5f93dc04f5ceb60a1b234ce2928c259b6ddbe2604d075cbf5f5d51a97f" + "signature": "sha256:81da7477f866f68f73a55003c5ea2e9a1ebc2c30bc7f6b884fa153c45265f794" }, "nbformat": 3, "nbformat_minor": 0, @@ -1077,13 +1077,47 @@ { "metadata": {}, "output_type": "pyout", - "prompt_number": 38, + "prompt_number": 51, "text": [ "[1, 2, 5, 7, 8, 9, (1, 2), (4, 2)]" ] } ], - "prompt_number": 38 + "prompt_number": 51 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## reversed" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Iterates over the sequence elements in reverse order" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "list(reversed(seq))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "metadata": {}, + "output_type": "pyout", + "prompt_number": 53, + "text": [ + "[(1, 2), (1, 2), (4, 2), 1, 5, 2, 9, 9, 7, 8, 1, 5, 2]" + ] + } + ], + "prompt_number": 53 }, { "cell_type": "markdown", @@ -1176,7 +1210,7 @@ ] } ], - "prompt_number": 43 + "prompt_number": 50 }, { "cell_type": "markdown",