How to Think Like a Computer Scientist: Learning with Python 3» - PDF

Description
How to Think Like a Computer Scientist How to Think Like a Computer Scientist: Learning with Python How to Think Like a Computer Scientist: Learning with Python» next index How to Think Like a Computer

Please download to get full document.

View again

of 20
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Information
Category:

Internet & Technology

Publish on:

Views: 17 | Pages: 20

Extension: PDF | Download: 0

Share
Transcript
How to Think Like a Computer Scientist How to Think Like a Computer Scientist: Learning with Python How to Think Like a Computer Scientist: Learning with Python» next index How to Think Like a Computer Scientist Learning with Python (RLE) Version date: November 0 by Peter Wentworth, Jeffrey Elkner, Allen B. Downey, and Chris Meyers (based on nd edition by Jeffrey Elkner, Allen B. Downey, and Chris Meyers) Corresponding author: Source for this RLE version: https://code.launchpad.net/~thinkcspy-rle-team/thinkcspy/thinkcspy- rle Search Page Copyright Notice Foreword Preface Preface- This Rhodes Local Edition (RLE) of the book Contributor List Chapter The way of the program Chapter Variables, expressions, and statements Chapter Hello, little turtles! Chapter Functions Chapter Conditionals Chapter Fruitful functions Chapter 7 Iteration Chapter 8 Strings Chapter 9 Tuples Chapter 0 Event handling Chapter Lists Chapter Modules Chapter Files Chapter List Algorithms Chapter Classes and Objects - the Basics Chapter Classes and Objects - Digging a little deeper Chapter 7 PyGame 9:: PM] How to Think Like a Computer Scientist How to Think Like a Computer Scientist: Learning with Python Chapter 8 Recursion Chapter 9 Exceptions Chapter 0 Dictionaries Chapter Even more OOP Chapter Collections of Objects Chapter Inheritance Chapter Linked Lists Chapter Stacks Chapter Queues Chapter 7 Trees Appendix A Debugging Appendix B An odds-and-ends Workbook Appendix C Configuring Ubuntu for Python Development Appendix D Customizing and Contributing to the Book Appendix E Some Tips, Tricks, and Common Errors GNU Free Document License Search Page How to Think Like a Computer Scientist: Learning with Python» next index Copyright 0, Peter Wentworth, Jeffrey Elkner, Allen B. Downey and Chris Meyers. Created using Sphinx :: PM] Index How to Think Like a Computer Scientist: Learning with Python How to Think Like a Computer Scientist: Learning with Python» index Index Symbols A B C D E F G H I J K L M N O P Q R S T U V W Symbols n + sequence A abbreviated assignment abecedarian series abstract data type (ADT) accumulator algorithm, [], [], [] deterministic aliases, [], [] alternative execution ambiguity animation rate argument, [] argv assignment, [] tuple assignment statement, [], [] assignment token attribute, [], [], [], [], [] B baked animation bar chart base case, [] binary operator binary search binary tree bind blit block, [] body, [], [], [] boolean expression, [] boolean function, [] boolean value, [] branch, [] break statement breakpoint bug, [] builtin scope bump bytecode C call graph canvas, [] cargo chained conditional, [] character chatterbox function child child class chunking, [] class, [] class attribute client composition, [], [] (of functions) composition of functions compound data type, [], [] compound statement, [] body header computation pattern concatenate concatenation, [] condition, [] conditional 9:: PM] Index How to Think Like a Computer Scientist: Learning with Python clone, [] collection, [] command line command line argument command prompt comment, [] comments comparison of strings comparison operator, [] compile, [] chained conditional branching conditional execution conditional statement, [] conditionals nested constant time constructor continue statement, [] control flow, [] copy deep shallow counter counting pattern cursor, [] D data structure, [] recursive data type, [] dead code, [] debugging, [], [] decrement deep copy deep equality, [] default value, [] definite iteration definition function, [] recursive del statement, [] delimiter, [], [] deterministic algorithm development plan, [] dictionary, [] dir function directory, [] docstring, [], [] dot notation, [] dot operator, [] dot product Doyle, Arthur Conan E element, [], [] elif else embedded reference encapsulate encapsulation encode enumerate equality deep shallow escape sequence, [] eureka traversal evaluate event, [] exception, [], [], [] handling executable expression, [], [] boolean 9:: PM] Index How to Think Like a Computer Scientist: Learning with Python F fibonacci numbers field width FIFO file, [] text file handle file system float, [], [] flow of execution, [], [] for loop, [], [], [], [], [] for loop traversal (for) formal language, [] formatting strings fractal Cesaro torn square Sierpinski triangle frame frame rate fruitful function, [] fully qualified name function, [], [], [] argument composition len parameter pure function call function composition, [] function definition, [], [] function type functional programming style fundamental ambiguity theorem G game loop, [] generalization, [] generalize generic data structure global scope H hand trace handle, [] handle an exception handler, [] handling an exception header line help helper high-level language, [] Holmes, Sherlock I if if statement immediate mode immutable, [], [], [] immutable data type, [] implementation import statement, [], [], [], [] in and not in operator (in, not in) in operator increment incremental development, [] indefinite iteration initialization (of a variable) initializer method input input dialog instance, [], [] instantiate int, [], [] integer integer division, [] Intel interface interpret, [] 9:: PM] Index How to Think Like a Computer Scientist: Learning with Python index, [], [], [] negative indexing ([]) infinite loop, [] infinite recursion, [] infix inheritance invariant invoke, [] is operator item, [], [] item assignment iteration, [], [] J join justification K key, [] key-value pair, [] keyword, [] L leaf len function length function (len) level lifetime, [] linear linear search linear time link linked list linked queue Linux list, [], [] append nested, [] list index list traversal, [] literalness local scope local variable, [], [] logarithm logical operator, [], [] loop, [] loop body, [] loop variable, [] low-level language, [] M Make Way for Ducklings mapping type, [] matrix, [] McCloskey, Robert memo, [] Merge algorithm meta-notation, [] method, [], [], [] middle-test loop mode modifier, [], [], [] module, [], [], [] modulus operator, [] mutable, [], [] mutable data type, [], [] N namespace, [] naming collision natural language, [] negative index nesting newline, [] Newton's method node 9:: PM] Index How to Think Like a Computer Scientist: Learning with Python nested conditionals nested list, [], [] nested loop non-volatile memory None, [] normalized O object, [], [], [] object code object-oriented language object-oriented programming, [] objects and values operand, [] operations on strings operator, [] comparison in logical, [] modulus operator overloading optional parameter, [] order of operations P parameter, [], [] optional parent parent class parse, [], [] pass statement path pattern pattern of computation Pentium pixel poetry poll, [] polymorphic portability portable post-test loop postfix postorder pre-test loop precondition prefix notation preorder print function priority queue Priority Queue probe problem solving program, [], [] program development program tracing programming language promise, [], [] prompt prose provider pure function, [] PyGame PyScripter single stepping Python shell Q queue Queue queueing policy R raise random numbers range recursive definition, [] redundancy refactor 9:: PM] Index How to Think Like a Computer Scientist: Learning with Python range function, [] reassignment, [] rectangle recursion, [] infinite recursive call, [] recursive data structure refactoring code return statement, [] return value, [] root rules of precedence, [] runtime error, [], [], [] S safe language scaffolding, [], [] scalar multiplication scope builtin global local script semantic error, [] semantics, [] sequence, [], [] shallow copy shallow equality, [] short-circuit evaluation, [] shuffle siblings side effect, [] single-step singleton slice, [], [] slicing ([:]) socket source code split sprite stack diagram state state snapshot, [] statement, [] assignment continue del, [] if import, [] pass return statement block statement: break step size str, [] string string comparison ( , , =, =, ==,!=) string formatting string module string operations string slice strings and lists style subexpression sublist, [] subscript operator substring surface, [] syntax, [] syntax error, [] T tab, [] table temporary variable, [] terminating condition test suite Test-driven development traverse trichotomy triple quoted string truncation try... except try... except... finally 9:: PM] Index How to Think Like a Computer Scientist: Learning with Python test-driven development (TDD) text file, [] token, [], [] trace traceback tracing a program traversal, [] tuple, [] assignment return value tuple assignment turtle module two-dimensional table type conversion type conversion, [] type converter functions U underscore character unit testing unit tests unreachable code V value, [], [], [] boolean variable, [] local, [] temporary variable name veneer volatile memory W while loop while statement whitespace wrapper wrapping code in a function, [] How to Think Like a Computer Scientist: Learning with Python» index Copyright 0, Peter Wentworth, Jeffrey Elkner, Allen B. Downey and Chris Meyers. Created using Sphinx :: PM] Copyright Notice How to Think Like a Computer Scientist: Learning with Python How to Think Like a Computer Scientist: Learning with Python» previous next index Copyright Notice Copyright (C) Peter Wentworth, Jeffrey Elkner, Allen B. Downey and Chris Meyers. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version. or any later version published by the Free Software Foundation; with Invariant Sections being Foreword, Preface, and Contributor List, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled GNU Free Documentation License. How to Think Like a Computer Scientist: Learning with Python» previous next index Copyright 0, Peter Wentworth, Jeffrey Elkner, Allen B. Downey and Chris Meyers. Created using Sphinx ::0 PM] Search How to Think Like a Computer Scientist: Learning with Python How to Think Like a Computer Scientist: Learning with Python» index Search From here you can search these documents. Enter your search words into the box below and click search . Note that the search function will automatically search for all of the words. Pages containing fewer words won't appear in the result list. How to Think Like a Computer Scientist: Learning with Python» index Copyright 0, Peter Wentworth, Jeffrey Elkner, Allen B. Downey and Chris Meyers. Created using Sphinx :: PM] Foreword How to Think Like a Computer Scientist: Learning with Python How to Think Like a Computer Scientist: Learning with Python» previous next index Foreword By David Beazley As an educator, researcher, and book author, I am delighted to see the completion of this book. Python is a fun and extremely easy-to-use programming language that has steadily gained in popularity over the last few years. Developed over ten years ago by Guido van Rossum, Python s simple syntax and overall feel is largely derived from ABC, a teaching language that was developed in the 980 s. However, Python was also created to solve real problems and it borrows a wide variety of features from programming languages such as C++, Java, Modula-, and Scheme. Because of this, one of Python s most remarkable features is its broad appeal to professional software developers, scientists, researchers, artists, and educators. Despite Python s appeal to many different communities, you may still wonder why Python? or why teach programming with Python? Answering these questions is no simple task especially when popular opinion is on the side of more masochistic alternatives such as C++ and Java. However, I think the most direct answer is that programming in Python is simply a lot of fun and more productive. When I teach computer science courses, I want to cover important concepts in addition to making the material interesting and engaging to students. Unfortunately, there is a tendency for introductory programming courses to focus far too much attention on mathematical abstraction and for students to become frustrated with annoying problems related to low-level details of syntax, compilation, and the enforcement of seemingly arcane rules. Although such abstraction and formalism is important to professional software engineers and students who plan to continue their study of computer science, taking such an approach in an introductory course mostly succeeds in making computer science boring. When I teach a course, I don t want to have a room of uninspired students. I would much rather see them trying to solve interesting problems by exploring different ideas, taking unconventional approaches, breaking the rules, and learning from their mistakes. In doing so, I don t want to waste half of the semester trying to sort out obscure syntax problems, unintelligible compiler error messages, or the several hundred ways that a program might generate a general protection fault. One of the reasons why I like Python is that it provides a really nice balance between the practical and the conceptual. Since Python is interpreted, beginners can pick up the language and start doing neat things almost immediately without getting lost in the problems of compilation and linking. Furthermore, Python comes with a large library of modules that can be used to do all sorts of tasks ranging from web-programming to graphics. Having such a practical focus is a great way to engage students and it allows them to complete significant projects. However, Python can also serve as an excellent foundation for introducing important computer science concepts. Since Python fully supports procedures and classes, students can be gradually introduced to topics such as procedural abstraction, data structures, and object-oriented programming all of which are applicable to later courses on Java or C++. Python even borrows a number of features from functional programming languages and can be used to introduce concepts that would be covered in more detail in courses on Scheme and Lisp. In reading Jeffrey s preface, I am struck by his comments that Python allowed him to see a higher level of success and a lower level of frustration and that he was able to move faster with better results. 9::7 PM] Foreword How to Think Like a Computer Scientist: Learning with Python Although these comments refer to his introductory course, I sometimes use Python for these exact same reasons in advanced graduate level computer science courses at the University of Chicago. In these courses, I am constantly faced with the daunting task of covering a lot of difficult course material in a blistering nine week quarter. Although it is certainly possible for me to inflict a lot of pain and suffering by using a language like C++, I have often found this approach to be counterproductive especially when the course is about a topic unrelated to just programming. I find that using Python allows me to better focus on the actual topic at hand while allowing students to complete substantial class projects. Although Python is still a young and evolving language, I believe that it has a bright future in education. This book is an important step in that direction. David Beazley University of Chicago Author of the Python Essential Reference How to Think Like a Computer Scientist: Learning with Python» previous next index Copyright 0, Peter Wentworth, Jeffrey Elkner, Allen B. Downey and Chris Meyers. Created using Sphinx ::7 PM] Preface How to Think Like a Computer Scientist: Learning with Python How to Think Like a Computer Scientist: Learning with Python» previous next index Preface By Jeffrey Elkner This book owes its existence to the collaboration made possible by the Internet and the free software movement. Its three authors a college professor, a high school teacher, and a professional programmer never met face to face to work on it, but we have been able to collaborate closely, aided by many other folks who have taken the time and energy to send us their feedback. We think this book is a testament to the benefits and future possibilities of this kind of collaboration, the framework for which has been put in place by Richard Stallman and the Free Software Foundation. How and why I came to use Python In 999, the College Board s Advanced Placement (AP) Computer Science exam was given in C++ for the first time. As in many high schools throughout the country, the decision to change languages had a direct impact on the computer science curriculum at Yorktown High School in Arlington, Virginia, where I teach. Up to this point, Pascal was the language of instruction in both our first-year and AP courses. In keeping with past practice of giving students two years of exposure to the same language, we made the decision to switch to C++ in the first year course for the school year so that we would be in step with the College Board s change for the AP course the following year. Two years later, I was convinced that C++ was a poor choice to use for introducing students to computer science. While it is certainly a very powerful programming language, it is also an extremely difficult language to learn and teach. I found myself constantly fighting with C++ s difficult syntax and multiple ways of doing things, and I was losing many students unnecessarily as a result. Convinced there had to be a better language choice for our first-year class, I went looking for an alternative to C++. I needed a language that would run on the machines in our GNU/Linux lab as well as on the Windows and Macintosh platforms most students have at home. I wanted it to be free software, so that students could use it at home regardless of their income. I wanted a language that was used by professional programmers, and one that had an active developer community around it. It had to support both procedural and object-oriented programming. And most importantly, it had to be easy to learn and teach. When I investigated the choices with these goals in mind, Python stood out as the best candidate for the job. I asked one of Yorktown s talented students, Matt Ahrens, to give Python a try. In two months he not only learned the language but wrote an application called pyticket that enabled our staff to report technology problems via the Web. I knew that Matt could not have finished an application of that scale in so short a time in C++, and this accomplishment, combined with Matt s positive assessment of Python, suggested that Python was the solution I was looking for. Finding a textbook Having decided to use Python in both of my introductory computer science classes the following year, the most pressing problem was the lack of an available textbook. Free documents came to the rescue. Earlier in the year, Richard Stallman had introduced me to Allen 9::0 PM] Preface How to Think Like a Computer Scientist: Learning with Python Downey. Both of us had written to Richard expressing an interest in developing free educational materials. Allen had already written a first-year computer science textbook, How to Think Like a Computer Scientist. When I read this book, I knew immediately that I wanted to use it in my class. It was the clearest and most helpful computer science text I had seen. It emphasized the processes of thought involved in programming rather than the features of a particular language. Reading it immediately made me a better teacher. How to Think Like a Computer Scientist was not just an excellent book, but it had been released under the GNU public license, which meant it could be used freely and modified to meet the needs of its user. Once I decided to use Python, it occurred to me that I could translate Allen s original Java version of the book into the new language. While I would not have been able to write a textbook o
Related Search
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks