{ "metadata": { "name": "", "signature": "sha256:2d5527cee2d14f67c2f5fd4cdfcbb27ae6cb62aa3eec37f9815dae10c6c114db" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Chapter 12: Pointers and Arrays" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example reverse3.c, Page 264" ] }, { "cell_type": "code", "collapsed": false, "input": [ "N=10\n", "li = raw_input(\"Enter %d numbers: \" % N) #accepting input in list\n", "a = map(int, li.split()) \n", "print \"In reverse order: \",\n", "for i in a[::-1]: #print reversed list\n", " print i," ], "language": "python", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "stream": "stdout", "text": [ "Enter 10 numbers: 34 82 49 102 7 94 23 11 50 31\n" ] }, { "output_type": "stream", "stream": "stdout", "text": [ "In reverse order: 31 50 11 23 94 7 102 49 82 34\n" ] } ], "prompt_number": 1 }, { "cell_type": "code", "collapsed": false, "input": [], "language": "python", "metadata": {}, "outputs": [] } ], "metadata": {} } ] }