This chapter will get you up and running with Python, from downloading it to writing simple programs. Please send comments, corrections, and suggestions to I: BASICS Getting Started Text files used in the text and exercises are available here. In preparing this book the Python documentation was indispensable. Part III contains information on the features of Python that allow you to accomplish big things with surprisingly little code. You should find Part II to be a concise, but not superficial, treatment on GUI programming. If you are one of those people, you should be able to breeze through the first several chapters. Though this book was designed to be used in an introductory programming course, it is also useful for those with prior programming experience looking to learn Python. All of the topics in this part of the book are things that I have found useful at one point or another. This part of the book could also serve as a reference or as a place for interested and motivated students to learn more. If you are structuring a one-semester course around this book, you might want to pick a few topics in Part III to go over. Part III contains a lot of the fun and interesting things you can do with Python. The final chapter of Part II covers a bit about the Python Imaging Library. For instance, this section presents a 20-line working (though not perfect) tic-tac-toe game. You can very quickly write some nice programs using Tkinter. Part II is about graphics, mostly GUI programming with Tkinter. The final four chapters of Part I are about dictionaries, text files, functions, and object-oriented programming. Chapter 10 contains a bunch of miscellaneous topics, all of which are useful, but many can be skipped if need be. While you can get away without using list comprehensions, they provide an elegant and efficient way of doing things. In particular, that chapter covers list comprehensions, which I use extensively later in the book. Much of this can be skipped, though it is all interesting and useful. Chapter 8 contains some more advanced list topics. Chapter 6 (strings) should be done before Chapter 7 (lists). Chapter 5 is useful, but not all of it is critical. The first four chapters are critically important. In terms of structuring a course around this book or learning on your own, the basis is most of Part I. Interested readers should progress from this book to a book that has more on computer science and the design and organization of large programs. This book is not designed as a thorough preparation for a career in software engineering. In fact, the things I cover in the book are the things that I have found most useful or interesting in my programming experience, and this book serves partly to document those things for myself. The style of programming in this book is geared towards the kinds of programming things I like to do-short programs, often of a mathematical nature, small utilities to make my life easier, and small computer games. But this book is not designed to cover everything, and I recommend reading other books and the Python documentation to fill in the gaps. Some of these details are filled in later in the book, though other details are never filled in. I leave out a lot of technical details and sometimes I oversimplify things. Most of these students have no prior programming experience, and that has affected my approach. This book started out as about 30 pages of notes for students in my introductory programming class at Mount St. I also like to jump right into things and fill in background information as I go, rather than covering the background material first. I summarize information in tables and give a lot of short example programs. My aim here is for something in the spirit of a tutorial but still useful as a reference. Reference books contain a lot of good information, but they are often too terse, and they don't often give you a sense of what is important. I like how tutorials get you up and running quickly, but they can often be a little wordy and disorganized. My goal here is for something that is partly a tutorial and partly a reference book. Text files needed for Chapter 12 and some exercises are available here. I don't have solutions available to the exercises here, but here is a separate set of a few hundred exercises and solutions. Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License
0 Comments
Leave a Reply. |