文件名称:
Springer.Python.Programming.Fundamentals.2011
开发工具:
文件大小: 4mb
下载次数: 0
上传时间: 2012-02-02
详细说明: 1 Introduction . . . . . . . . . . 1 1.1 The Python Programming Language . . . . . . . 2 1.2 Installing Python and Wing IDE 101 . . . . . . . 3 1.3 Writing Your First Program . . . . . . . . 7 1.4 What is aComputer? . . . . . . . 8 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 SyntaxErrors . . . . . . . 18 1.10 Types of Values . . . . . . 19 1.11 The Reference Type and Assignment Statements . . . . 20 1.12 Integers and Real Numbers . . . . . . . . 21 1.13 Strings . . . . . . . 24 1.14 Integer to String Conversion and Back Again . . . . . . 25 1.15 Getting Input . . . . . . . 26 1.16 Formatting Output . . . . . . . . 27 1.17 When Things Go Wrong . . . . . 30 1.18 Review Questions . . . . . . . . . 33 1.19 Exercises . . . . . . . . . 34 1.20 Solutions to Practice Problems . . . . . . 36 2 Decision Making . . . . . . . . 41 2.1 FindingtheMaxofThree 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 ShortCircuitLogic . . . . . . . . 53 2.6 Comparing Floats for Equality . . . . . . 54 2.7 ExceptionHandling . . . . . . . . 55 2.8 ReviewQuestions . . . . . . . . . 57 2.9 Exercises . . . . . . . . . 58 2.10 Solutions to Practice Problems . . . . . . 61 3 Repetitive Tasks . . . . . . . . 65 3.1 Operators . . . . . . . . . 67 3.2 Iterating Over a Sequence . . . . . 69 3.3 Lists . . . . . . . . 71 3.4 The Guess and Check Pattern for Lists . . . . . . 74 3.5 Mutability of Lists . . . . . . . . 75 3.6 The Accumulator Pattern . . . . . 79 3.7 Reading from and Writing to a File . . . . 80 3.8 ReadingRecords fromaFile . . . . . . . 82 3.9 ReviewQuestions . . . . . . . . . 85 3.10 Exercises . . . . . . . . . 86 3.11 Solutions to Practice Problems . . . . . . 88 4 Using Objects . . . . . . . . . . 93 4.1 Constructors . . . . . . . . 96 4.2 Accessor Methods . . . . . . . . 98 4.3 Mutator Methods . . . . . . . . . 98 4.4 ImmutableClasses . . . . . . . . 99 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 WhyWriteFunctions? . . . . . . 120 5.2 PassingArguments andReturning aValue . . . . 121 5.3 ScopeofVariables . . . . . . . . 122 5.4 The Run-time Stack . . . . . . . . 126 5.5 MutableData andFunctions . . . . . . . 129 5.6 Predicate Functions . . . . . . . . 131 5.7 Top-DownDesign . . . . . . . . . 133 5.8 Bottom-UpDesign . . . . . . . . 134 5.9 RecursiveFunctions . . . . . . . . 134 5.10 The Main Function . . . . . . . . 136 5.11 Keyword Arguments . . . . . . . 139 5.12 Default Values . . . . . . . 140 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 TheRootWindow. . . . . . . . . 150 6.2 Menus . . . . . . . 151 6.3 Frames . . . . . . . . . . 152 6.4 TheTextWidget . . . . . . . . . 152 6.5 TheButtonWidget . . . . . . . . 153 6.6 Creating a Reminder! . . . . . . . 154 6.7 Finishing up the Reminder! Application . . . . . 156 6.8 Label andEntryWidgets . . . . . 157 6.9 Layout Management . . . . . . . 158 6.10 Message Boxes . . . . . . 159 6.11 Review Questions . . . . . . . . . 160 6.12 Exercises . . . . . . . . . 161 6.13 Solutions to Practice Problems . . . . . . 164 7 Defining Classes . . . . . . . . 167 7.1 Creating an Object . . . . . . . . 168 7.2 Inheritance . . . . . . . . 172 7.3 ABouncingBallExample . . . . . . . . 178 7.4 Polymorphism. . . . . . . 180 7.5 Getting Hooked on Python . . . . . . . . 181 7.6 ReviewQuestions . . . . . . . . . 184 7.7 Exercises . . . . . . . . . 184 7.8 Solutions to Practice Problems . . . . . . 190 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 Appendix I The Bouncing Ball Program . . . . . 227 Glossary . . . . . . . . . . . 231 References . . . . . . . . . . 237 Index . . . . . . . . . 239 ...展开收缩
(系统自动生成,下载前可以参看下载内容)
下载文件列表
相关说明
- 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
- 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度。
- 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
- 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
- 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
- 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.