楼主: Toyotomi
2414 1

Python Programming Fundamentals [推广有奖]

贵宾

大师

1%

还不是VIP/贵宾

-

TA的文库  其他...

商学院英文书籍

威望
3
论坛币
492743 个
通用积分
64.9357
学术水平
1058 点
热心指数
1455 点
信用等级
1031 点
经验
127830 点
帖子
6622
精华
5
在线时间
2849 小时
注册时间
2009-12-29
最后登录
2022-3-11

初级热心勋章 初级学术勋章 初级信用勋章 中级热心勋章 中级学术勋章 高级热心勋章 高级学术勋章 中级信用勋章 特级热心勋章 高级信用勋章 特级学术勋章

相似文件 换一批

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
Undergraduate Topics in Computer Science
2011
Python Programming FundamentalsAuthors:
ISBN: 978-1-84996-536-1 (Print) 978-1-84996-537-8  (Online)

Python Programming Fundamentals

Series: Undergraduate Topics in Computer Science

Lee, Kent D.

2011, XII, 241 p.

ISBN 978-1-84996-537-8

  Immediately available per PDF-download (no DRM, watermarked)


About this textbook
  • Employs a classroom-tested, hands-on learning approach
  •                                         Offers numerous examples and solved practice exercises
  •                                         An associated website provides additional resources for instructors
Computer programming is a skill that can bring great enjoyment from the creativity involved in designing and implementing a solution to a problem. This classroom-tested and easy-to-follow textbook teaches the reader how to program using Python, an accessible language which can be learned incrementally. Through an extensive use of examples and practical exercises, students will learn to recognize and apply abstract patterns in programming, as well as how to inspect the state of a program using a debugger tool.
Features:
  • Contains numerous examples and solved practice exercises designed for an interactive classroom environment
  • Highlights several patterns which commonly appear in programs, and presents exercises that reinforce recognition and application of these patterns
  • Introduces the use of a debugger, and includes supporting material that reveals how programs work
  • Presents the Tkinter framework for building graphical user interface applications and event-driven programs
  • Provides helpful additional resources for instructors at the associated website: http://cs.luther.edu/~leekent/CS1
This hands-on textbook for active learning in the classroom will enable undergraduates in computer science to develop the necessary skills to begin developing their own programs. It employs Python as the introductory language due to the wealth of support available for programmers.
Dr. Kent D. Lee is Associate Professor of Computer Science at the Department of Computer Science at Luther College, Decorah, Iowa, USA. He is the author of the successful Springer textbook, Programming Languages: An Active Learning Approach.

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 Finding theMax ofThree 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
ix
x Contents
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
Contents xi
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
xii Contents
Appendix I The Bouncing Ball Program . . . . . . . . . . . . . . . . . . . . . 227
Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239




  • Reviews

From the reviews:
“Phython’s recent gain in popularity, this new work is timely. Though intended primarily as a textbook for introductory programming classes, it will work well as a guide to self-teaching. … The writing is clear and succinct; the choice of topics is excellent; and the examples work well. By introducing the Tkinter graphical user interface kit, the book does much to help readers work with interesting programs without the need for another book. … Summing Up: Highly recommended. Students of all levels, professionals/practitioners, and general readers.” (S. L. Tanimoto, Choice, Vol. 48 (9), May, 2011)
“This book follows a classical Kernighan-Ritchie-style approach … . Each chapter concludes with review questions, exercises, and solutions for practice problems--all making this book applicable for self-study. Overall, this is a fine book. … a well-written, well-structured, self-contained modern introduction to programming with an important platform-independent language.” (Klaus Galensa, ACM Computing Reviews, December, 2011)






Python Programming Fundamentals.pdf (4.15 MB, 需要: 4 个论坛币)


二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:Fundamentals Fundamental Programming Fundamenta Program Online website all additional available

已有 1 人评分经验 学术水平 热心指数 信用等级 收起 理由
accumulation + 100 + 1 + 1 + 1 精彩帖子

总评分: 经验 + 100  学术水平 + 1  热心指数 + 1  信用等级 + 1   查看全部评分

本帖被以下文库推荐

I am looking for a talent scout who may appreciate me...

>>>>>>>生产和运营管理<<<<<<<
沙发
DM小菜鸟 发表于 2015-1-18 18:05:05 |只看作者 |坛友微信交流群
感谢分享,就是有点小贵...

使用道具

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-4-20 10:54