Added reversed snippet.

This commit is contained in:
Donne Martin 2015-01-25 12:44:19 -05:00
parent d3482764e8
commit 86a1463df3

View File

@ -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",