Example: marketing

Think Python, 2E - DePaul University

Allen B. DowneyThink PythonHOW TO Think LIKE A COMPUTER SCIENTIST2nd EditionUpdated for python 3 Allen B. DowneyBostonThink PythonSECOND EDITION978-1-491-93936-9[LSI] Think Pythonby Allen B. DowneyCopyright 2016 Allen Downey. All rights in the United States of by O Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA Reilly books may be purchased for educational, business, or sales promotional use. Online editions arealso available for most titles ( ). For more information, contact our corporate/institutional sales department: 800-998-9938 or Meghan BlanchetteProduction Editor: Kristen BrownCopyeditor: Nan ReinhardtProofreader: Amanda KerseyIndexer: Allen DowneyInterior Designer: David FutatoCover Designer: Karen MontgomeryIllustrator: Rebecca DemarestAugust 2012: First EditionDecemb

For “The turtle Module” on page 35 I switched from my own turtle graphics package, called Swampy, to a more standard Python module, turtle, which is easier to install and more powerful. • I added a new chapter called “The Goodies”, which introduces some additional Python features that are not strictly necessary, but sometimes handy.

Tags:

  Python, Chapter, Graphics, Turtle, Turtle graphics

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Advertisement

Transcription of Think Python, 2E - DePaul University

1 Allen B. DowneyThink PythonHOW TO Think LIKE A COMPUTER SCIENTIST2nd EditionUpdated for python 3 Allen B. DowneyBostonThink PythonSECOND EDITION978-1-491-93936-9[LSI] Think Pythonby Allen B. DowneyCopyright 2016 Allen Downey. All rights in the United States of by O Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA Reilly books may be purchased for educational, business, or sales promotional use. Online editions arealso available for most titles ( ). For more information, contact our corporate/institutional sales department: 800-998-9938 or Meghan BlanchetteProduction Editor: Kristen BrownCopyeditor: Nan ReinhardtProofreader: Amanda KerseyIndexer: Allen DowneyInterior Designer: David FutatoCover Designer: Karen MontgomeryIllustrator: Rebecca DemarestAugust 2012: First EditionDecember 2015: Second EditionRevision History for the Second Edition2015-11-20: First ReleaseSee for release O Reilly logo is a registered trademark of O Reilly Media, Inc.

2 Think python , the cover image of aCarolina parrot, and related trade dress are trademarks of O Reilly Media, the publisher and the author have used good faith efforts to ensure that the information andinstructions contained in this work are accurate, the publisher and the author disclaim all responsibilityfor errors or omissions, including without limitation responsibility for damages resulting from the use ofor reliance on this work. Use of the information and instructions contained in this work is at your ownrisk.

3 If any code samples or other technology this work contains or describes is subject to open sourcelicenses or the intellectual property rights of others, it is your responsibility to ensure that your usethereof complies with such licenses and/or python is available under the Creative Commons Attribution-NonCommercial UnportedLicense. The author maintains an online version at of ContentsPreface.. Way of the Program.. 1 What Is a Program? 1 Running python 2 The First Program 3 Arithmetic Operators 3 Values and Types

4 4 Formal and Natural Languages 5 Debugging 7 Glossary 8 Exercises , Expressions and Statements.

5 11 Assignment Statements 11 Variable Names 12 Expressions and Statements 12 Script Mode 13 Order of Operations

6 14 String Operations 15 Comments 15 Debugging 16 Glossary 17 Exercises.

7 21 Function Calls 21 Math Functions 22iiiComposition 23 Adding New Functions 23 Definitions and Uses 25 Flow of Execution 25 Parameters and Arguments 26 Variables and Parameters Are Local 27 Stack Diagrams

8 28 Fruitful Functions and Void Functions 29 Why Functions? 30 Debugging 30 Glossary 31 Exercises Study.

9 Interface Design.. 35 The turtle Module 35 Simple Repetition 37 Exercises 38 Encapsulation 38

10 Generalization 39 Interface Design 40 Refactoring 41A Development Plan 42docstring 43 Debugging 43 Glossary 44 Exercises and Recursion.