Think Python: How to Think Like a Computer Scientist How to Think Like a Computer Scientist by Allen B. Downey This is the first edition of Think Python, which uses Python 2. If you are using Python 3, you might want to use the second edition, which is here. Buy this book at Amazon.com Download Think Python in PDF. Read Think Python in HTML. Example programs and solutions to some problems are here (links to specific examples are in the book). Description Think Python is an introduction to Python programming for beginners. Some examples and exercises are based on Swampy, a Python package written by the author to demonstrate aspects of software design, and to give readers a chance to experiment with simple graphics and animation. Think Python is a Free Book. If you have comments, corrections or suggestions, please send me email at feedback{at}thinkpython{dot}com. Other Free Books by Allen Downey are available from Green Tea Press. Download Precompiled copies of the book are available in PDF. Earlier Versions Translations and adaptations
Non-Programmer's Tutorial for Python 3 Authors Contributors to this book Front matter Initial remarks Intro Installing and using Python – where to get help Hello, World The famous first program – screen output – variables – numbers and calculations Who Goes There? Interactive input – strings Count to 10 while loops Decisions if statements Debugging Finding out what goes wrong Defining Functions Structuring programs with the use of functions Advanced Functions Example (Almost) mind-blowing example of how programmers can think Lists Variables containing more than one value For Loops A second kind of loop Boolean Expressions Computer logic – True and False – and and or – not Dictionaries Variables containing key/value pairs Using Modules Extensions to the standard set of functionality More on Lists Using elements or parts of lists Revenge of the Strings More advanced text manipulations File IO Reading from files and writing to files Dealing with the imperfect How to handle errors Recursion Recursive Functions Intro to Object Oriented Programming in Python 3 The End
Edsger Dijkstra - Discipline in Thought I found a great video interview with Edsger Wybe Dijkstra. You have probably heard of Dijkstra's algorithm. He invented it. In the interview professor Edsger talks about his thoughts on software development. He compares two very different styles of programming - Mozart style of programming vs. From the video one can understand that Edsger preferred Mozart's style of programming. His daily discipline lead to hundreds of crystal clear scientific papers, which have now been archived in EWD Archive. You are welcome to watch interview with Edsger Dijkstra: At the beginning of video Dijkstra criticizes current software release methodology. Edsger Dijkstra's quotes from video: Computer science is no more about computers than astronomy is about telescopes. I found a funny poster of Dijkstra:
Joe's Blog: An intro to modern OpenGL. Chapter 1: The Graphics Pipeline An intro to modern OpenGL. Chapter 1: The Graphics Pipeline updated April 5, 2010 17:12:05 PDT Table of Contents | Chapter 2 » OpenGL has been around a long time, and from reading all the accumulated layers of documentation out there on the Internet, it's not always clear what parts are historic and what parts are still useful and supported on modern graphics hardware. Update: Join the Reddit discussion. What is OpenGL? Another recent development has been the adoption of general purpose GPU (GPGPU) libraries, including nVidia's CUDA and Khronos' OpenCL. For these tutorials, I'm going to assume you're already a programmer and that you know C, but that you haven't necessarily seen OpenGL or done graphics programming before. Where do I get OpenGL, GLUT, and GLEW? OpenGL comes standard in some form or another on MacOS X, Windows, and most Linux distributions. To install GLUT and GLEW, look for the binary packages on their respective sites. The graphics pipeline The vertex and element arrays
Introduction to Dynamic Programming Dynamic programming is a method for efficiently solving a broad range of search and optimization problems which exhibit the characteristics of overlappling subproblems and optimal substructure. I'll try to illustrate these characteristics through some simple examples and end with an exercise. Happy coding! Contents Overlapping Subproblems A problem is said to have overlapping subproblems if it can be broken down into subproblems which are reused multiple times. def factorial(n): if n == 0: return 1 return n*factorial(n-1) Thus the problem of calculating factorial(n) depends on calculating the subproblem factorial(n-1). Fibonacci Numbers The problem of calculating the nth Fibonacci number does, however, exhibit overlapping subproblems. def fib(n): if n == 0: return 0 if n == 1: return 1 return fib(n-1) + fib(n-2) The problem of calculating fib(n) thus depends on both fib(n-1) and fib(n-2). def fib2(n): n2, n1 = 0, 1 for i in range(n-2): n2, n1 = n1, n1 + n2 return n2+n1 Optimal Substructure
Add-on Developer Hub Commentary on the Sixth Edition UNIX Operating System This directory contains a copy of John Lion's “A commentary on the Sixth Edition UNIX Operating System”. This form of the document was published on the USENET alt.folklore.computers newsgroup in May 1994. It's available in several forms: A gzipped tarball of the files after I had unpacked them and formatted them to PostScript in June 1994. This tarball includes separate PostScript files for the odd and even pages, for printing out in a double-sided format. The source code is not included, but you can get that from cuzco.com. Drawing Graphics with Canvas - MDC Doc Center Most of this content (but not the documentation on drawWindow) has been rolled into the more expansive Canvas tutorial, this page should probably be redirected there as it's now redundant but some information may still be relevant. Introduction With Firefox 1.5, Firefox includes a new HTML element for programmable graphics. <canvas> creates a fixed size drawing surface that exposes one or more rendering contexts. The 2D Rendering Context A Simple Example To start off, here's a simple example that draws two intersecting rectangles, one of which has alpha transparency: function draw() { var ctx = document.getElementById('canvas').getContext('2d'); ctx.fillStyle = "rgb(200,0,0)"; ctx.fillRect (10, 10, 55, 50); ctx.fillStyle = "rgba(0, 0, 200, 0.5)"; ctx.fillRect (30, 30, 55, 50);} draw(); The draw function gets the canvas element, then obtains the 2d context. The fillRect, strokeRect, and clearRect calls render a filled, outlined, or clear rectangle. Using Paths Graphics State Additional Features
Language Study A Comparison of Programming Languages for Scientific Processing (It's all about managing complexity!) D.McClain 01/99 A study was conducted in the interest of finding a programming language that would seriously cut down on the maintenance load of our existing software base. Secondarily, a language was sought that could enhance our future capabilities with more elaborate support for data structures. Finally, runtime performance was considered, apart from complexity issues to see if and how much performance would be sacrificed in going to a candidate language. Of course, in any study of this sort, there are subjective judgements as to suitability of a language in one area or another. We have nearly 300,000 lines of active support code in a variety of languages spanning IDL, Lisp, Mathematica, Basic, and C/C++. General criteria for judging a language How shall we judge a language? Next, much of our work involves the production of scientific graphs and image displays. Languages of this study
open source framework, web application software development | Flex - Adobe The Adobe USA site has been optimized for users within the United States. If you live outside the U.S., we recommend that you visit your local site for the most relevant information, including pricing, promotions, and local events. United States Canada - English Your country selection will be remembered for future visits. You can change this selection at any time using the country selector at the bottom of the page. Le site web américain d'Adobe a été optimisé pour les utilisateurs résidant aux États-Unis. Canada - Français Le pays choisi sera enregistré pour vos prochaines visites. View complete list of countries ›
The Structure and Interpretation of the Computer Science Curricu Matthias Felleisen, Robert Bruce Findler, Matthew Flatt, Shriram Krishnamurthi Journal of Functional Programming, 2004 Abstract Twenty years ago Abelson and Sussman’s Structure and Interpretation of Computer Programs radically changed the intellectual landscape of introductory computing courses. Paper PostScriptPDF These papers may differ in formatting from the versions that appear in print. Properties - The Python Saga - Part 3 Properties come out of a tired programming language genesis. In the beginning, there were structs. The trouble with structs was that an opaque data structure could not programmatically monitor or intercept access and mutation of its member data. So that's not a big deal; we could solve the problem with classes. The best practice to avoid programming yourself into a corner was to never expose a datum; you would write accessor and mutator functions, whether you needed them at the moment or not. The idea of managed properties came along eventually in various languages (Python, C#, some implementations of JavaScript, and recent versions of [C]). Lets observe this design shift in Python. class Foo(object): def __init__(self); self.bar = 10 Here's some other fellow's code that uses your class: foo = Foo() foo.bar = 20 print foo.bar del foo.bar So there you have it. Now we have a Foo class that transparently maintains the invariant that "bar" will always be half of "baz".
Shannon's Work Claude Shannon's creation in the 1940's of the subject of information theory is arguably one of the great intellectual achievements of the twentieth century. Information theory has had an important and significant influence on mathematics, particularly on probability theory and ergodic theory, and Shannon's mathematics is in its own right a considerable and profound contribution to pure mathematics. But Shannon did his work primarily in the context of communication engineering, and it is in this area that it stands as a unique monument. In his classical paper of 1948 and its sequels, he formulated a model of a communication system that is distinctive for its generality as well as for its amenability to mathematical analysis. Let us look first at his model. Shannon gives elegant answers to such questions. One of Shannon's most brilliant insights was the separation of problems like these (where the encoder must take both the source and channel into account) into two coding problems.