Practical Programming

Practical Programming: An Introduction To Computer Science Using Python

Download

Introduction

This book uses the Python programming language to introduce standard CS1 topics and a handful of useful applications. We chose Python for several reasons:
• It is free and well documented. In fact, Python is one of the largest and best-organized open source projects going.
• It runs everywhere. The reference implementation, written in C, is used on everything from cell phones to supercomputers, and it’s supported by professional-quality installers for Windows, Mac OS, and Linux.
• It has a clean syntax. Yes, every language makes this claim, but in the four years we have been using it at the University of Toronto, we have found that students make noticeably fewer “punctuation” mistakes with Python than with C-like languages.
• It is relevant. Thousands of companies use it every day; it is one of the three “official languages” at Google, and large portions of the game Civilization IV are written in Python. It is also widely used by academic research groups.
• It is well supported by tools. Legacy editors like Vi and Emacs all have Python editing modes, and several professional-quality IDEs are available. (We use a free-for-students version of one called Wing IDE.)

We use an “objects first, classes second” approach: students are shown how to use objects from the standard library early on but do not create their own classes until after they have learned about flow control and basic data structures. This compromise avoids the problem of explaining Java’s public static void main(String[ ] args) to someone who has never programmed.

We have organized the book into two parts. The first covers fundamental programming ideas: elementary data types (numbers, strings, lists, sets, and dictionaries), modules, control flow, functions, testing, debugging, and algorithms. Depending on the audience, this material can be covered in nine or ten weeks.

The second part of the book consists of more or less independent chapters on more advanced topics that assume all the basic material has been covered. The first of these chapters shows students how to create their own classes and introduces encapsulation, inheritance, and polymorphism; courses for computer science majors will want to include this material. The other chapters cover application areas, such as 3D graphics, databases, GUI construction, and the basics of web programming; these will appeal to both computer science majors and students from the sciences and will allow the book to be used for both.

Lots of other good books on Python programming exist.
Share This