200字范文,内容丰富有趣,生活中的好帮手!
200字范文 > 计算机编程 设计入门 计算机编程入门图文教程_计算机程序设计教程 计算机编程入门

计算机编程 设计入门 计算机编程入门图文教程_计算机程序设计教程 计算机编程入门

时间:2019-01-31 01:48:21

相关推荐

计算机编程 设计入门 计算机编程入门图文教程_计算机程序设计教程 计算机编程入门

图文结合的编程入门书,简单易懂,入门必备基础书。不过是英文的,需要一点点阅读能力

Hello world!

Computer Programming for Kids

and Other Beginners

WAR尺 EN SANDE

CARTER SANDE

MANNING

Greenwich

74°w.long)

For online information and ordering of this and other Manning books, please visit

.Thepublisheroffersdiscountsonthisbookwhenorderedinquantity

For more information, please contact:

Special Sales Department

Manning publications co

Sound View Court 3B fax:(609)877-8256

Greenwich,cT06830email:orders@

o by Manning Publications Co. All rights reserved

No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in

any form or by means electronic, mechanical, photocopying, or otherwise, without prior written

permission of the publisher:

Many of the designations used by manufacturers and sellers to distinguish their products are

claimed as trademarks. Where those designations appear in the book, and manning

Publications was aware of a trademark claim, the designations have been printed in initial caps

or all caps

Q Recognizing the importance of preserving what has been written, it is Mannings policy to have

the books we publish printed on acid-free paper, and we exert our best efforts to that end

Recognizing also our responsibility to conserve the resources of our planet, Manning books are

printed on paper that is at least 15% recycled and processed without elemental chlorine

Manning publications co

Development editor: Cynthia Kane

Sound view court 3B

Copyeditors: Andy carroll, Anna Welles

Greenwich. CT06830

Technical proofreader: Ignacio Beltran-Torres

Typesetter: Marija Tudor

Illustrator: Martin murtonen

Cover designer: Leslie haimes

Seventh, corrected printing, may

ISBN978-1933988-498

Printed in the united states of america

78910-MAL-14131211

o our family,

tho inspire, encourage, and support us

in school work. and life

Contents

Preface xiii

Acknowledgments xⅸx

About this book xxi

Getting Started 1

Installing Python 1. Starting Python with IDLE 2. Instructions,

please 3- Interacting with Python 5. Time to program 7

Running your first program 8. If something goes wrong 9

Your second program 11

2 Remember This-Memory and Variables 14

Input, processing, output 14. Names 16. What's in a name? 20

Numbers and strings 21. How"variable"are they? 22. the new

me 23

3 Basic Math 26

The four basic operations 27. Operators 28- Order of

operations 29 a Two more operators 30- Really big and really

small 33

viii Contents

4 Types of Data 38

Changing types 38. Getting more information

Type-conversion errors 42. Using type conversions 42

5 Input 44

45·The

command and the comma 45

Inputting numbers 47. Input from the Web 49

6 GUls--Graphical User Interfaces 52

What's a gu!52· Our first gu|53· GUI input54

Pick your flavor 55. The number-guessing game . again 59

Other GUI pieces 60

7 Decisions, Decisions 62

Testing, testing 62.Indenting 65. Am I seeing double? 65

Other kinds of tests 66. What happens if the test is false? 67

Testing for more than one condition 69. Using"and"69

Using"or"70· Using"not”70

8 Loop the Loop 74

Counting loops 75. Using a counting loop 77. A shortcut

78. A matter of style--loop variable names 80

Counting by steps 82. Counting without numbers 84

While we re on the subject.. 84 Bailing out of a loop

an

d

85

9 Just for You--Comments 89

Adding comments 89. Single-line comments 90. End-of-line

comments 90. Multiline comments 90 Commenting style 91

Commenting out 92

10 Game Time 94

Skⅰer94

11 Nested and Variable Loops 99

Nested loops 99. Variable loops 101 Variable nested loops 102

Even more variable nested loops 103. Using nested loops 105

CoNTeNTS

12 Collecting Things Together-Lists 112

What's a list? 112, Creating a list 113. Adding things to a

list 113. What's the dot? 114. Lists can hold anything 114

Getting items from a list 115,"Slicing"a list 116. Modifying

items 118. Other ways of adding to a list 118. Deleting from a

list 120. Searching a list 121. Looping through a list 122

Sorting lists 123. Mutable and immutable 126. Lists of lists: tables

of data 126

13 Functions 131

Functions-the building blocks 131 calling a function 133

Passing arguments to a function 134. Functions with more than

one argument 137- Functions that return a value 139 variable

scope 140. Forcing a global 143. a bit of advice on naming

variables 144

14 Objects 146

Objects in the real world 147. Objects in Python 147

Object= attributes + methods 148. What's the dot? 149

Creating objects 149. An example class-HotDog 154

Hiding the data 159. Polymorphism and inheritance 159

Thinking ahead 162

15 Modules 164

What's a module? 164: Why use modules? 164. Buckets of

blocks 165. How do we create modules? 165. how do we use

modules? 166. Namespaces 167. Standard modules 170

16 Graphics 174

Getting some help-Pygame 174. A Pygame window 175

Drawing in the window 178. Individual pixels 186

mages190· Let's get moving!192· Animation193

Smoother animation 194. Bouncing the ball 196

Wrapping the ball 198

17 Sprites and Collision Detection 202

Sprites 202. Bump! Collision detection 208

Counting time 212

计算机编程 设计入门 计算机编程入门图文教程_计算机程序设计教程 计算机编程入门教程-其它文档类资源...

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。