background preloader

How to Think Like a Computer Scientist

How to Think Like a Computer Scientist
Learning with Python by Allen Downey, Jeff Elkner and Chris Meyers. This book is now available for sale at Lulu.com. How to Think... is an introduction to programming using Python, one of the best languages for beginners. How to Think... is a Free Book available under the GNU Free Documentation License. Please send suggestions, corrections and comments about the book to feedback{at}thinkpython{dot}com. Download The book is available in a variety of electronic formats: Precompiled copies of the book are available in PDF and Postscript . Translations Here are some translations of the book into other (natural) languages: Spanish translation by Gregorio Inda. Other Free Books by Allen Downey are available from Green Tea Press. If you are using this book and would like to make a contribution to support my work, please consider making a donation toward my web hosting bill by clicking on the icon below.

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

Hacking Secret Ciphers with Python - Chapters Chapter 1 Read online: Chapter 1 - Making Paper Cryptography Tools PDF of the Caesar Cipher WheelInteractive Virtual Cipher Wheel Chapter 2 Read online: Chapter 2 - Downloading and Installing Python Download Python 3Download pyperclip.py Chapter 3 Read online: Chapter 3 - The Interactive Shell Chapter 4 Read online: Chapter 4 - String and Writing Programs Download source: hello.py Copy source to clipboard: Use the online diff tool to find typos in your code: hello.py Chapter 5 Read online: Chapter 5 - The Reverse Cipher Download source: reverseCipher.py Use the online diff tool to find typos in your code: reverseCipher.py Chapter 6 Read online: Chapter 6 - The Caesar Cipher Download source: caesarCipher.py Use the online diff tool to find typos in your code: caesarCipher.py Download source: caesarCipher2.py Use the online diff tool to find typos in your code: caesarCipher2.py Download source: password.py Use the online diff tool to find typos in your code: password.py Download source: password2.py Chapter 7

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

Invent Your Own Computer Games with Python - Chapters Chapter 1 Read online: Chapter 1 - Installing Python Videos: Chapter 2 Read online: Chapter 2 - The Interactive Shell Chapter 3 Read online: Chapter 3 - Strings Download source: hello.py Copy source to clipboard: Use the online diff tool to find typos in your code: hello.py Chapter 4 Read online: Chapter 4 - Guess the Number Download source: guess.py Use the online diff tool to find typos in your code: guess.py Chapter 5 Read online: Chapter 5 - Jokes Download source: jokes.py Use the online diff tool to find typos in your code: jokes.py Chapter 6 Read online: Chapter 6 - Dragon Realm Download source: dragon.py Use the online diff tool to find typos in your code: dragon.py Chapter 7 Read online: Chapter 7 - Using the Debugger Chapter 8 Read online: Chapter 8 - Flow Charts Chapter 9 Read online: Chapter 9 - Hangman Download source: hangman.py Use the online diff tool to find typos in your code: hangman.py Chapter 10 Read online: Chapter 10 - Tic Tac Toe Download source: tictactoe.py Chapter 11 Download source: bagels.py

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 Book Natural Language Processing with Python – Analyzing Text with the Natural Language Toolkit Steven Bird, Ewan Klein, and Edward Loper This version of the NLTK book is updated for Python 3 and NLTK 3. 0. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. Bibliography Term Index This book is made available under the terms of the Creative Commons Attribution Noncommercial No-Derivative-Works 3.0 US License. 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

Dive Into Python 3 You are here: • Dive Into Python 3 Dive Into Python 3 covers Python 3 and its differences from Python 2. Table of Contents (expand) Also available on dead trees! The book is freely licensed under the Creative Commons Attribution Share-Alike license. you@localhost:~$ git clone © 2001–11 Mark Pilgrim

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

Related: