Example: barber

Python for Informatics

Python for InformaticsExploring InformationVersion SeveranceCopyright 2009-2013 Charles history:September 2013:Published book on Amazon CreateSpaceJanuary 2010:Published book using the University of Michigan Espresso Book 2009:Major revision to chapters 2-10 fromThink Python : How to Think Likea Computer Scientistand writing chapters 1 and 11-15 to producePython for In-formatics: Exploring InformationJune 2008:Major revision, changed title toThink Python : How to Think Like a Com-puter 2007:Major revision, changed title toHow to Think Like a ( Python ) 2002:First edition ofHow to Think Like a Computer work is licensed under a Creative Common Unported License. This license is available You can see what the author considers commercial and non-commercialuses of this material as well as license exemptions in the Appendix titled Copyright LATEX source for theThink Python : How to Think Like a Computer Scientistversionof this book is available for Informatics : Remixing an Open BookIt is quite natural for academics who are continuously told to publish or perish to want to always create something from scratch that is their own fresh book is an experiment in not starting from scratch, but instead re-mixing the book titledThink Python : How to Think Like a Computer Scientistwritten byAllen B.

Preface Python for Informatics: Remixing an Open Book It is quite natural for academics who are continuously told to “publish or perish” to want to always create something from scratch that is their own fresh creation.

Tags:

  Python, Informatics, Python for informatics

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Transcription of Python for Informatics

1 Python for InformaticsExploring InformationVersion SeveranceCopyright 2009-2013 Charles history:September 2013:Published book on Amazon CreateSpaceJanuary 2010:Published book using the University of Michigan Espresso Book 2009:Major revision to chapters 2-10 fromThink Python : How to Think Likea Computer Scientistand writing chapters 1 and 11-15 to producePython for In-formatics: Exploring InformationJune 2008:Major revision, changed title toThink Python : How to Think Like a Com-puter 2007:Major revision, changed title toHow to Think Like a ( Python ) 2002:First edition ofHow to Think Like a Computer work is licensed under a Creative Common Unported License. This license is available You can see what the author considers commercial and non-commercialuses of this material as well as license exemptions in the Appendix titled Copyright LATEX source for theThink Python : How to Think Like a Computer Scientistversionof this book is available for Informatics : Remixing an Open BookIt is quite natural for academics who are continuously told to publish or perish to want to always create something from scratch that is their own fresh book is an experiment in not starting from scratch, but instead re-mixing the book titledThink Python : How to Think Like a Computer Scientistwritten byAllen B.

2 Downey, Jeff Elkner and December of 2009, I was preparing to teachSI502 - Networked Program-mingat the University of Michigan for the fifth semester in a row and decidedit was time to write a Python textbook that focused on exploring data instead ofunderstanding algorithms and abstractions. My goal in SI502 is to teach peoplelife-long data handling skills using Python . Few of my students were planningto be be professional computer programmers. Instead, they planned be librarians,managers, lawyers, biologists, economists, etc. who happened to want to skillfullyuse technology in their chosen never seemed to find the perfect data-oriented Python book for my course so Iset out to write just such a book. Luckily at a faculty meeting three weeks beforeI was about to start my new book from scratch over the holiday break, Dr. AtulPrakash showed me theThink Pythonbook which he had used to teach his Pythoncourse that semester. It is a well-written Computer Science text with a focus onshort, direct explanations and ease of overall book structure has been changed to get to doing data analysis problemsas quickly as possible and have a series of running examples and exercises aboutdata analysis from the very chapters 2-10 are similar to theThink Pythonbook but there have been somechanges.

3 Nearly all number-oriented exercises have been replaced with data-oriented exercises. Topics are presented in the order to needed to build increas-ingly sophisticated data analysis solutions. Some topics liketryandexceptarepulled forward and presented as part of the chapter on conditionals whileotherconcepts like functions are left until they are needed to handle program complex-ity rather introduced as an early lesson in abstraction. The word recursion doesnot appear in the book at 0. PrefaceIn chapters 1 and 11-15, all of the material is brand new, focusing on real-worlduses and simple examples of Python for data analysis including regular expres-sions for searching and parsing, automating tasks on your computer, retrievingdata across the network, scraping web pages for data, using web services, parsingXML data, and creating and using databases using Structured Query ultimate goal of all of these changes is a shift from a Computer Science toanInformatics focus is to only include topics into a first technology class that can beapplied even if one chooses not to become a professional who find this book interesting and want to further explore should look atAllen B.

4 Downey sThink Pythonbook. Because there is a lot of overlap betweenthe two books, students will quickly pick up skills in the additional areas of com-puting in general and computational thinking that are covered inThink given that the books have a similar writing style and at times have identicaltext and examples, you should be able to move quickly throughThink Pythonwitha minimum of the copyright holder ofThink Python , Allen has given me permission to changethe book s license on the material from his book that remains in this book fromtheGNU Free Documentation License to the more recent Creative Commons Attri-bution Share Alike license. This follows a general shift in open documentationlicenses moving from the GFDL to the CC-BY-SA ( Wikipedia). Using theCC-BY-SA license maintains the book s strong copyleft tradition while making iteven more straightforward for new authors to reuse this material as they see feel that this book serves an example of why open materials are so importantto the future of education, and want to thank Allen B.

5 Downey and CambridgeUniversity Press for their forward looking decision to make the book availableunder an open Copyright. I hope they are pleased with the results of my effortsand I hope that you the reader are pleased withourcollective would like to thank Allen B. Downey and Lauren Cowles for their help, patience,and guidance in dealing with and resolving the copyright issues around Arbor, MI, USAS eptember 9, 2013 Charles Severance is a Clinical Associate Professor at the University of MichiganSchool of for Think Python The strange history of Think Python (Allen B. Downey)vIn January 1999 I was preparing to teach an introductory programming class inJava. I had taught it three times and I was getting frustrated. The failure rate inthe class was too high and, even for students who succeeded, the overall level ofachievement was too of the problems I saw was the books. They were too big, with too muchunnecessary detail about Java, and not enough high-level guidance about how toprogram.

6 And they all suffered from the trap door effect: they would start out easy,proceed gradually, and then somewhere around Chapter 5 the bottom would fallout. The students would get too much new material, too fast, and I would spendthe rest of the semester picking up the weeks before the first day of classes, I decided to write my own book. Mygoals were: Keep it short. It is better for students to read 10 pages than not read 50pages. Be careful with vocabulary. I tried to minimize the jargon and define eachterm at first use. Build gradually. To avoid trap doors, I took the most difficult topics andsplit them into a series of small steps. Focus on programming, not the programming language. I included the min-imum useful subset of Java and left out the needed a title, so on a whim I choseHow to Think Like a Computer first version was rough, but it worked. Students did the reading, and theyunderstood enough that I could spend class time on the hard topics, the interestingtopics and (most important) letting the students released the book under the GNU Free Documentation License, which allowsusers to copy, modify, and distribute the happened next is the cool part.

7 Jeff Elkner, a high school teacher in Virginia,adopted my book and translated it into Python . He sent me a copy of his trans-lation, and I had the unusual experience of learning Python by reading and I revised the book, incorporated a case study by Chris Meyers, and in 2001we releasedHow to Think Like a Computer Scientist: Learning with Python , alsounder the GNU Free Documentation License. As Green Tea Press, I publishedthe book and started selling hard copies through and college bookstores. Other books from Green Tea Press are available 2003 I started teaching at Olin College and I got to teach Python for the firsttime. The contrast with Java was striking. Students struggled less, learned more,worked on more interesting projects, and generally had a lot more 0. PrefaceOver the last five years I have continued to develop the book, correctingerrors,improving some of the examples and adding material, especially exercises. In2008 I started work on a major revision at the same time, I was contacted by aneditor at Cambridge University Press who was interested in publishing the nextedition.

8 Good timing!I hope you enjoy working with this book, and that it helps you learn to programand think, at least a little bit, like a computer for Think Python (Allen B. Downey)First and most importantly, I thank Jeff Elkner, who translated my Java bookintoPython, which got this project started and introduced me to what has turnedout tobe my favorite also thank Chris Meyers, who contributed several sections toHow to Think Likea Computer I thank the Free Software Foundation for developing the GNU Free Docu-mentation License, which helped make my collaboration with Jeff and Chris also thank the editors at Lulu who worked onHow to Think Like a thank all the students who worked with earlier versions of this book and allthecontributors (listed in an Appendix) who sent in corrections and I thank my wife, Lisa, for her work on this book, and Green Tea Press, andeverything else, B. DowneyNeedham MAAllen Downey is an Associate Professor of Computer Science at the Franklin College of Why should you learn to write programs?

9 Creativity and motivation .. Computer hardware architecture .. Understanding programming .. Words and sentences .. Conversing with Python .. Terminology: interpreter and compiler .. Writing a program .. What is a program? .. The building blocks of programs .. What could possibly go wrong? .. The learning journey .. Glossary .. Exercises .. 162 Variables, expressions and Values and types .. Variables .. Variable names and keywords .. Statements .. Operators and operands .. Expressions .. Order of operations .. Modulus operator .. String operations .. Asking the user for input .. Comments .. Choosing mnemonic variable names .. Debugging .. Glossary .. Exercises .. 303 Conditional Boolean expressions .. Logical operators .. Conditional execution .. Alternative execution.

10 Chained conditionals .. Nested conditionals .. Catching exceptions using try and except .. Short circuit evaluation of logical expressions .. Debugging .. Glossary .. Exercises .. 404 Function calls .. Built-in functions .. Type conversion functions .. Random numbers .. Math functions .. Adding new functions .. Definitions and uses .. Flow of execution .. Parameters and arguments .. Fruitful functions and void functions .. Why functions? .. Debugging .. Glossary .. Exercises .. 545 Updating variables .. Thewhilestatement .. Infinite loops .. Infinite loops andbreak.. Finishing iterations withcontinue.. Definite loops usingfor.. Loop patterns .. Debugging .. Glossary .. Exercises .. 656 A string is a sequence .. Getting the length of a string usinglen.


Related search queries