您好,欢迎光临本网站![请登录][注册会员]  
文件名称: Python Programming Fundamentals.pdf.pdf
  所属分类: 其它
  开发工具:
  文件大小: 4mb
  下载次数: 0
  上传时间: 2019-09-14
  提 供 者: weixin_********
 详细说明:Python Programming Fundamentals.pdfKent d. lee Python Programming Fundamentals ②S pringer Dr. Kent d. I Dept. Computer Science Luther college College Drive 700 52101 Decorah IA USA kentdlee luther. edu Series editor Ian mackie Advisory board Samson Abramsky, University of Oxford, Oxford, UK Chris Hankin, Imperial college london, London, UK Dexter Kozen, Cornell University, Ithaca, USA Andrew Pitts, University of Cambridge, Cambridge, UK Hanne riis Nielson, Technical University of Denmark, Lungby, Denmark Steven Skiena, Stony Brook University, Stony Brooks, USA lain Stewart, University of Durham, Durham, UK ISSN1863-7310 ISBN978-1-84996-536-1 e-ISBN978-1-84996-537-8 DOI10.1007/978-1-84996-537-8 Springer London Dordrecht Heidelberg New York British library Cataloguing in Publication Data A catalogue record for this book is available from the British Library Library of Congress Control Number: 2010937477 o Springer-Verlag London Limited 2011 Apart from any fair dealing for the purposes of research or private study, or criticism or review, as per- mitted under the Copyright, Designs and Patents Act 1988, this publication may only be reproduced stored or transmitted, in any form or by any means, with the prior permission in writing of the publish ers, or in the case of reprographic reproduction in accordance with the terms of licenses issued by the Copyright Licensing Agency. Enquiries concerning reproduction outside those terms should be sent to the publishers The use of registered names, trademarks, etc, in this publication does not imply, even in the absence of a specific statement, that such names are exempt from the relevant laws and regulations and therefore free for general use The publisher makes no representation, express or implied, with regard to the accuracy of the information contained in this book and cannot accept any legal responsibility or liability for any errors or omissions that may be made Printed on acid-free paper SpringerispartofSpringerScience+businessMedia(www.springer.com) 欢迎加入非盈利 Pyt hor程学习交流Q群783462347,群里免费提供50+本 Pyt hoη书籍! Preface Computer Science is a creative, challenging, and rewarding discipline. Computer program- mers,sometimes called software engineers, solve problems involving data: computing, moving, and handling large quantities of data are all tasks made easier or possible by computer programs. Money magazine ranked software engineer as the number one job in America in terms of flexibility, creativity, low stress levels, ease of entry, compensation and job growth within the field [4] Learning to program a computer is a skill that can bring you great enjoyment because of the creativity involved in designing and implementing a solution to a problem. Python is a good first language to learn because there is very little overhead in learning to write simple programs. Python also has many libraries available that make it easy to write some very interesting programs including programs in the areas of Computer Graphics and Graphical User Interfaces: two topics that are covered in this text In this text, students are taught to program by giving them many examples and practice exercises with solutions that they can work on in an interactive classroom environment The interaction can be accomplished using a computer or using pen and paper. By making the classroom experience active, students reflect on and apply what they have read and heard in the classroom. By using a skill or concept right away, students quickly discover if they need more reinforcement of the concept, while teachers also get immediate feedback There is a big difference between seeing a concept demonstrated and using it yourself and this text encourages applying concepts immediately to test understanding. This is vital in Computer Science since new skills and concepts build on what we have already learned In several places within this book there are examples presented that highlight patterns of programming. These patterns appear over and over in programs we write. In this text, patterns like the Accumulator Pattern and the guess and check pattern are presented and exercises reinforce the recognition and application of these and other abstract patterns used in problem-solving. Learning a language is certainly one important goal of an introductory text, but acquiring the necessary problem-solving skills is even more important. Students learn to solve problems on their own by recognizing when certain patterns are relevant and then applying these patterns in their own programs Recent studies in Computer Science Education indicate the use of a debugger can greatly enhance a students understanding of programming [1]. a debugger is a tool that 欢迎加入非盈利 Pyt hor程学习交流Q群783462347,群里免费提供5004本 Pyt hon书籍」 Preface lets the programmer inspect the state of a program at any point while it is executing There is something about actually seeing what is happening as a program is executed that helps make an abstract concept more concrete This text introduces students to the use of a de- bugger and includes exercises and examples that show students how to use a debugger to discover how programs work There are additional resources available for instructors teaching from this text They include lecture slides and a sample schedule of lectures for a semester lon course. Solutions to all programming exercises are also available upon request. Visit http://cs.luther.edu/-leekent/csiformoreinformation Python is a good language for teaching introductory Computer Science because it is very accessible and can be incrementally taught so students can start to write programs be fore having to learn the whole language however at the same time python is also a devel oping language. Python 3. 1 was recently released to the public. This release of Python in cluded many performance enhancements which were very good additions to the language There were also some language issues with version 2. 6 and earlier that were cleaned up at the same time that were not backwards compatible. The result is that not all Python 2 pro grams are compatible with Python 3 and vice versa. Because both Python 2 and Python 3 are in use today, this text will point out the differences between the two versions where appropriate. These differences will be described by inset boxes titled Python 2 M 3 within the text where the differences are first encountered It is recommended that students reading this text use Python 3. 1 or later for writing and running their programs. All Python programs presented in the text are Python 3 programs The libraries used in this text all work with Python 3. However, there may be some libraries that have not been ported to Python 3 that a particular instructor would like to use. In terms of what is covered in this text, the differences between Python 2 and 3 are pretty minor and either language implementation will work to use with the text. Acknowledgments Id like to thank David Ranum, who encouraged me to write a text on introductory pro gramming that included some of the projects I've developed, and Brad Miller, who sug gested we try Python as an introductory language. It's wonderful to work with colleagues that care as much as i do about teaching students a rewarding and creative discipline. But most importantly, I would like to thank the students who have taken classes from me Teaching has given me back much more than the many hours i have invested in it and seeing a student grow in his or her programming skills is its own reward I would especially like to thank Nathaniel Lee, who not only let his dad teach him, but valuable feedback and for your willingness to lear text. Thank you, Nathan, for all your was a great sounding board and test subject for this w迎加入非盈利Ptho编程学习交流Q群783462347,群里免费提供500体hon书籍! Its Credits At times in this text Microsoft Windows is referred to when installing software Windows is a registered trademark of microsoft Corporation in the united states and other countries Mac os X is referred to at times within this text mac and mac os are trademarks of apple InC, registered in the U.S. and other countries. The Garmin Forerunner and Garmin Train- ing Center are referred to in Chap 4. Garmin is a registered trademark, and Forerunner and Training Center are trademarks of garmin Ltd. or its subsidiaries in the United States and other countries This book also introduces readers to Wing IDE 101, which is used in examples through- out the text. Wing IDE 101 is a free simplified edition of Wing IDE Professional, a full featured integrated development environment designed specifically for Python. For more informationonWingIde,seewww.wingware.comWingwareandwiNgIdearetrade marks or registered trademarks of wingware in the united states and other countries Suggestions I welcome suggestions for future printings of this text. If you like this text and have sug- gestions for future printings, please write up your suggestion(s)and email them to me. The more complete your write up, the more likely I will be to consider your suggestion If I select your suggestion for a future printing I'll be sure to include your name in the preface as a contributor to the text. Suggestions can be emailed to kentdleeluther. edu or kentdleegmail.com 欢迎加入非盈利 Pyt hor程学习交流Q群783462347,群里免费提供50+本 Pyt hoη书籍! Contents 1 ntroduction 1. 1 The Python Programming Language 1.2 Installing Python and Wing IDE 101 1.3 Writing Your First Program 2378 1.4 What is a Computer? 1.5 Binary Number Representation 10 1.6 What is a Programming Language? 13 1.7 Hexadecimal and Octal Representation 15 1. 8 Writing Your Second Program 16 1.9 Syntax Errors 18 1.10 Types ofⅤ alues. 1. 11 The Reference Type and Assignment Statements 20 1.12 Integers and Real numbers 21 1.13 Strings 4 1. 14 Integer to string Conversion and back again 1.15 Getting Input 1.16 Formatting Output 27 1.17 When Things Go Wrong 30 1.18 Review Questions 1. 19 Exercises 34 1. 20 Solutions to Practice Problems 2 Decision Making 2.1 Finding the Max of Three Integers 45 2.2 The Guess and Check pattern 47 2.3 Choosing from a List of Alternatives 48 2.4 The Boolean Type 50 2.5 Short Circuit Logic 2.6 Comparing Floats for Equality 2.7 Exception Handling 2.8 Review Questions 57 欢迎加入非盈利ythσ编程学习交流α群783462347,群里免费提供500体本Pth书籍 X ontents 2.9 Exercises 58 2.10 Solutions to practice Problems 3 Repetitive Tasks 3.1 Operators 3.2 Iterating Over a Sequence 3.3 Lists 3.4 The Guess and Check pattern for lists 74 3.5 Mutability of Lists 3.6 The Accumulator Pattern 79 3.7 Reading from and Writing to a file 3. 8 Reading records from a file 3.9 Review Questions 85 3.10 Exercises 86 3.11 Solutions to practice Problems 88 Using Objects 93 4.1 Constructors 96 4.2 Accessor methods 4.3 Mutator Methods 98 4.4 Immutable classes 4.5 Object-Oriented Programming 100 4.6 Working with XMl files 100 4.7 Extracting elements from an xml file 103 4. 8 Dictionaries 104 4.9 Getting at the data in an XML File 105 4.10 Working with Time 107 4.11 Parallel lists 107 4.12 Visualizing a workout 108 4. 13 Review Questions 110 4 14 Exercises 110 4.15 Solutions to practice problems 113 5 Defining Functions 119 5.1 Why Write Functions? 120 5.2 Passing arguments and returning a valu 121 5.3 Scope of Variables 5.4 The Run-time stack 126 5.5 Mutable data and functions 129 5.6 Predicate Functie 131 5.7 Top-Down Design 133 5.8 Bottom-Up Design 134 5.9 Recursive functions 134 5.10 The main Function 136 5.11 Keyword Arguments 139 欢迎加入非盈利 Pyt hor程学习交流Q群783462347,群里免费提供500+本 Pyt hon书籍 Contents 5.12 Default values 5.13 Functions with Variable Number of parameters 140 5.14 Dictionary Parameter Passing 141 5.15 Review Questions 142 5.16 Exercises 142 5.17 Solutions to Practice Problems 145 6 Event-Driven Programming 149 6.1 The root window 150 6.2 Menus 151 6.3F 6. 4 The Text Widge 6.5 The Button widget .153 6.6 Creating a reminder 6.7 Finishing up the Reminder! Application 156 6.8 Label and entry widgets 157 6.9 Layout m 158 6.10M B 6. 1 1 Review questions .160 6.12 Exercises 16l 6.13 Solutions to Practice Problems Cl 7.1 Creating an object 168 7.2 Inheritance 172 7.3 A Bouncing Ball Example 178 7.4 Polymorphism 180 7.5 Getting Hooked on Python l81 7.6 Review Questions 84 7.7 Exercises 7. 8 Solutions to practice Problems Appendix a Integer Operators 193 Appendix B Float Operators 195 Appendix C String Operators and methods 197 Appendix d list Operators and methods 201 Appendix e Dictionary Operators and Methods .203 Appendix f turtle methods 205 Appendix g TurtleScreen Methods 217 Appendix H The Reminder! Program 225
(系统自动生成,下载前可以参看下载内容)

下载文件列表

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度
  • 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.
 输入关键字,在本站1000多万海量源码库中尽情搜索: