1. 首页
  2. 编程语言
  3. Python
  4. IntroductiontoProgrammingUsingPython

IntroductiontoProgrammingUsingPython

上传者: 2019-04-27 21:57:30上传 PDF文件 12.72MB 热度 15次
介绍Python语言的入门书,循序渐进,实例和练习数量很多。英文原版。《经典原版书库:Python语言程序设计(英文版)》以“基础先行”方法介绍基本程序设计概念和方法,帮助学生循序渐进地学习所有必需和重要的基本概念。以“问题驱动”方法讲授程序设计技术,强调问题求解,而非语法。通过广泛的趣味性实例(涉及数学、自然科学、商业、金融、游戏、动画和多媒体领域)来激发学生的学习兴趣,为求解这些问题,适时地引入相关的语法和库。可以灵活介绍GUI相关主题。第1~6章使用内置的Turtle图形模块,其余部分使用Tkinter,这两种工具都是简单、易学的程序设计教学工具。每章的开始都有GUI实例,每章末尾还有专get with the programmingThrough the power of practice and immediate personalizedfeedback, myprogramminglab improves your performanceMyProgrammingLabLearnmoreatwww.myprogramminglab.comALWAYS LEARNINGPEARSONThis page intentionally left blankINTRODUCTION TOPROGRAMMING USⅠNGPYTHONY. Daniel LiangArmstrong Atlantic state UniversityPEARSONBoston Columbus Indianapolis New York San Francisco Upper Saddle RiverAmsterdam Cape Town Dubai London Madrid Milan Munich Paris Montreal TorontoDelhi Mexico City Sao Paulo Sydney Hong Kong Seoul Singapore Taipei TokyoEditorial director ecs: Marcia horton-Chief: MExecutive Editor: Tracy Dunkelbergerte Editor: carole SnydeDirector of Marketing: Patrice JonesMarketing manager: Yezan alayanMarketing Coordinator: Kathryn FerrantiDirector of production Vince o brienManaging editor: Jeff holcombProduction Project Manager: Heather mcnallManufacturing buyer: Lisa McDowellArt Director and Cover Designer: Anthony GemmellaroText Designer: Gillian hallCover Art: Life Aquatic"@ Arthur Xanthopoulos from Damaged PhotographyMedia editor: Daniel sandinFull-Service Project Management: Gillian HallComposition: LaserwordsPrinter/Binder: edwards brotherCover Printer: Lehigh-Phoenix color/hagerstownCredits and acknowledgments borrowed from other sources and reproduced, with permission, in this textbookappear on Credits page located in the end matterMicrosoft@ and Windows@ are registered trademarks of the Microsoft Corporation in the U.s.A. and other countries. Screen shots and icons reprinted with permission from the Microsoft Corporation. This book is not sponsoredor endorsed by or affiliated with the Microsoft CorporationCopyright o 2013 Pearson Education, Inc, publishing as Prentice Hall. All rights reserved. Manufactured in theUnited States of America. This publication is protected by Copyright, and permission should be obtained from thepublisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by anymeans, electronic, mechanical, photocopying, recording, or likewise. To obtain permission(s)to use material fromthis work, please submit a written request to Pearson Education, Inc, Permissions Department, One Lake Street,Upper Saddle river, New Jersey 07458, or you may fax your request to 201-236-3290Many of the designations by manufacturers and sellers to distinguish their products are claimed as trademarksWhere those designations appear in this book, and the publisher was aware of a trademark claim, the designationshave been printed in initial caps or all capsLibrary of Congress Cataloging-in-Publication Data on file.Prentice halls an imprint o10987654321PEARSON工SBN13:日7吕--13-己7471B-日www.pearsonhighered.com工SBN]0:0-13-己7471-号This book is dedicated to my former colleaguesat the National severe storms laboratoryin norman, oklahomaTo Samantha Michael and michellePREFACEDear readerwhat is programmingThis book assumes that you are a new programmer with no prior knowledge of programmingSo, what is programming? Programming solves problems by creating solutions--writingprograms-in a programming language. The fundamentals of problem solving and programmingare the same regardless of which programming language you use. You can learn programmingusing any high-level programming language such as Python, Java, C++, or C#t. Once you knowhow to program in one language, it is easy to pick up other languages, because the basic techniques for writing programs are the samehy python?So what are the benefits of learning programming using Python? Python is easy to learnand fun to program. Python code is simple, short, readable, intuitive, and powerful, and thusit is effective for introducing computing and problem solving to beginnersgraphicsBeginners are motivated to learn programming so they can create graphics. a big reasonfor learning programming using Python is that you can start programming using graphics onday one. We use Pythons built-in Turtle graphics module in Chapters 1-6 because it is a goodpedagogical tool for introducing fundamental concepts and techniques of programming. Weintroduce Pythons built-in tkinter in Chapter 9, because it is a great tool for developingcomprehensive graphical user interfaces and for learning object-oriented programming. BothTurtle and tkinter are remarkably simple and easy to use. more importantly they are valuablepedagogical tools for teaching the fundamentals of programming and object-orientedprogrammingoptional TurtleTo give instructors flexibility to use this book, we cover Turtle at the end of Chapters 1-6so they can be skipped as optional materialproblem-drivenThe book teaches problem solving in a problem-driven way that focuses on problem solving rather than syntax. We stimulate student interests in programming by using interestingexamples in a broad context. While the central thread of the book is on problem solving,appropriate Python syntax and library are introduced in order to solve the problems. To support the teaching of programming in a problem-driven way, the book provides a wide varietyof problems at various levels of difficulty to motivate students. In order to appeal to studentsin all majors, the problems cover many application areas in math, science, business, financialmanagement, gaming, animation, and multimediaAll data in Python are objects. We introduce and use objects from Chapter 3, but definingcustom classes are covered in the middle of the book starting from Chapter 7. The bookfundamentals firstfocuses on fundamentals first: it introduces basic programming concepts and techniques onselections, loops, and functions before writing custom classesexamples and exercisesThe best way to teach programming is by example, and the only way to learn programmingis by doing Basic concepts are explained by example and a large number of exercises withvarious levels of difficulty are provided for students to practice. Our goal is to produce a textthat teaches problem solving and programming in a broad context using a wide variety ofnteresting examples and exercisesSincerely,Y. Daniel Liangy.daniel.liang@gmail.comwww.cs.armstrong.edu/liangwww.pearsonhighered.com/liangPreface viiPedagogical FeaturesThe book uses the following elements to get the most from the materialObjectives list what students should learn in each chapter. This will help them determinewhether they have met the objectives after completing the chapterThe Introduction opens the discussion with representative problems to give the reader anoverview of what to expect from the chapterKey points highlight the important concepts covered in each sectionCheck Points provide review questions to help students track their progress and evaluatetheir learningProblems, carefully chosen and presented in an easy-to-follow style, teach problemsolving and programming concepts. The book uses many small, simple, and stimulatingexamples to demonstrate important ideasKey Terms are listed with a page number to give students a quick reference to the important terms introducd in the chapterThe Chapter Summary reviews the important subjects that students should understandand remember. It helps them reinforce the key concepts they have learned in the chapter.Test Questions are available online, grouped by sections for students to do self-test onprogramming concepts and techniquesProgramming Exercises are grouped by sections to provide students with opportunitiesto apply on their own the new skills they have learned. The level of difficulty is rated aseasy (no asterisk), moderate ( ) hard (*), or challenging (**). The trick of learningprogramming is practice, practice, and practice. To that end, the book provides a greatmany exercisesNotes, Tips, and Cautions are inserted throughout the text to offer valuable advice andinsight on important aspects of program developmentProvides additional information on the subject and reinforces important conceptsTipTeaches good programming style and practiceCautionHelps students steer away from the pitfalls of programming errorsFlexible Chapter OrderingsGraphics is a valuable pedagogical tool for learning programming. The book uses Turtlegraphics in Chapters 1-6 and Tkinter in the rest of the book. However, the book is designed togive the instructors the flexibility to skip the sections on graphics or to cover them later. Thefollowing diagram shows the chapter dependenciesChapter 10, Lists can be covered right after Chapter 6, Functions. Chapter 14, TuplesSets, and Dictionaries can be covered after Chapter 10viii prefacePart i: Fundamentals ofPart II: Object-OrientedPart Ill: Data Structures andProgrammingPrrogrammllngalgorithmsChapter 1 Introduction toChapter 7 Objects and ClassesChapter 14 Tuples, Sets, andComputers, Programs, andDictionariesPythonChapter 8 More on Strings andSpecial MethodsChapter 15 RecursionChapter 2 ElementaryProgrammingChapter 9 GUI ProgrammingChapter 16 Developing EfficientUsing tkinterAlgorithmsChapter 3 MathematicalFunctions, Strings, andChapter 10 ListsChapter 17 SortingObjectsChapter 11 MultidimensionalChapter 18 Linked Lists, StacksChapter 4 SelectionsListsQueues, and Priority QueuesChapter 5 LoopsChapter 12 Inheritance andChapter 19 Binary Search TreesPolymorphismChapter 6 FunctionsChapter 20 AVL TreesChapter 13 Files and ExceptionHandlinChapter 21 HashImplementing Dictionaries andSetsNote: Chapters 16-23 are bonuschapters available from theChapter 22 Graphs andCIpanion WebsitepplicationsChapter 23 Weighted Graphsand ApplicationsOrganization of the bookThe chapters can be grouped into three parts that, taken together, form a comprehensive introduction to Python programming. Because knowledge is cumulative, the early chapters pro-vide the conceptual basis for understanding programming and guide students through simpleexamples and exercises; subsequent chapters progressively present Python programming indetail, culminating with the development of comprehensive applicationsPart I: Fundamentals of Programming( Chapters 1-6)The first part of the book is a stepping stone, preparing you to embark on the journey of learning programming. You will begin to know Python( Chapter 1)and will learn fundamental programming techniques with data types, variables, constants, assignments, expressions,operators, objects, and simple functions and string operations( Chapters 2-3), selection statements(Chapter 4), loops( Chapter 5), and functions(Chapter 6)Part II: Object-Oriented Programming(Chapters 7-13)This part introduces object-oriented programming. Python is an object-oriented programminlanguage that uses abstraction, encapsulation, inheritance, and polymorphism to provide greatflexibility, modularity, and reusability in developing software. You will learn object-orientedprogramming( Chapters 7-8), GUI programming using Tkinter( Chapter 9), lists( Chapter10), multidimensional lists( Chapter 11), inheritance, polymorphism, and class designChapter 12), and files and exception handling( Chapter 13)Part II: Data Structures and Algorithms( Chapters 14-15 and Bonus Chapters 16-23)This part introduces the main subjects in a typical data structures course. Chapter 14 introduces Python built-in data structures: tuples, sets, and dictionaries. Chapter 15 introduces
下载地址
用户评论