Hello World!: Computer Programming for Kids and Other Beginners

Paperback
from $0.00

Author: Warren Sande

ISBN-10: 1933988495

ISBN-13: 9781933988498

Category: Programming - General & Miscellaneous

Search in google:

"Computer Programming for Kids" gives kids—or anyone who wants to learn programming from a fresh perspective - a gentle but thorough introduction to the world of computer programming. This book uses the Python language, a free, open source language which is ideal as a teaching tool. Python was chosen because it is easy to learn, free, and compatible with Windows, Mac and Linux. Python is also the base language for the "One Laptop per Child" program. This book covers all the basic concepts of computer programming, and applies them to fun, interesting topics like, computer graphics, game programming, and simulations. It is aimed at kids, but anyone who wants to learn how to program a computer can use it. You don't need to know anything about programming to use the book. Just a normal user-level familiarity with how to use a computer is enough to learn from this book. You can use the book to easily learn to interact with the computer on a programming level. This book can be used at home or in a classroom setting. There is nothing like it currently on the market.

Preface xiiiAcknowledgments xixAbout this book xxi1 Getting Started 1Installing Python 1Starting Python with IDLE 2Instructions, please 3Interacting with Python 5Time to program 7Running your first program 8If something goes wrong 9Your second program 112 Remember This-Memory and Variables 14Input, processing, output 14Names 16What's in a name? 20Numbers and strings 21How "variable" are they? 22The new me 233 Basic Math 26The four basic operations 27Operators 28Order of operations 29Two more operators 30Really big and really small 334 Types of Data 38Changing types 38Getting more information: type() 41Type-conversion errors 42Using type conversions 425 Input 44raw_input () 45The print command and the comma 45Inputting numbers 47Input from the Web 496 GUIs-Graphical User Interfaces 52What's a GUI? 52Our first GUI 53GUI input 54Pick your flavor 55The number-guessing game ... again 59Other GUI pieces 607 Decisions, Decisions 62Testing, testing 62Indenting 65Am I seeing double? 65Other kinds of tests 66What happens if the test is false? 67Testing for more than one condition 69Using "and" 69Using "or" 70Using "not" 708 Loop the Loop 74Counting loops 75Using a counting loop 77A shortcut-range () 78A matter of style-loop variable names 80Counting by steps 82Counting without numbers 84While we're on the subject ... 84Bailing out of a loop-break and continue 859 Just for You-Comments 89Adding comments 89Single-line comments 90End-of-line comments 90Multiline comments 90Commenting style91Commenting out 9210 Game Time 94Skier 9411 Nested and Variable Loops 99Nested loops 99Variable loops 101Variable nested loops 102Even more variable nested loops 103Using nested loops 10512 Collecting Things Together-Lists 112What's a list? 112Creating a list 113Adding things to a list 113What's the dot? 114Lists can hold anything 114Getting items from a list 115"Slicing" a list 116Modifying items 118Other ways of adding to a list 118Deleting from a list 120Searching a list 121Looping through a list 122Sorting lists 123Mutable and immutable 126Lists of lists: tables of data 12613 Functions 131Functions-the building blocks 131Calling a function 133Passing arguments to a function 134Functions with more than one argument 137Functions that return a value 139Variable scope 140Forcing a global 143A bit of advice on naming variables 14414 Objects 146Objects in the real world 147Objects in Python 147Object = attributes + methods 148What's the dot? 149Creating objects 149An example class-HotDog 154Hiding the data 159Polymorphism and inheritance 159Thinking ahead 16215 Modules 164What's a module? 164Why use modules? 164Buckets of blocks 165How do we create modules? 165How do we use modules? 166Namespaces 167Standard modules 17016 Graphics 174Getting some help-Pygame 174A Pygame window 175Drawing in the window 178Individual pixels 186Images 190Let's get moving! 192Animation 193Smoother animation 194Bouncing the ball 196Wrapping the ball 19817 Sprites and Collision Detection 202Sprites 202Bump! Collision detection 208Counting time 21218 A New Kind of Input-Events 217Events 217Keyboard events 219Mouse events 223Timer events 225Time for another game-PyPong 22719 Sound 239More help from Pygame-mixer 239Making sounds versus playing sounds 240Playing sounds 240Controlling volume 243Repeating music 245Adding sounds to PyPong 245More wacky sounds 246Adding music to PyPong 25020 More GUIs 254Working with PythonCard 254Components 255Making our GUI do something 258The return of event handlers 259Moving the button 260More useful GUIs 260TempGUI 261What's on the menu? 26621 Print Formatting and Strings 273New lines 274Horizontal spacing-tabs 275Inserting variables in strings 277Number formatting 278Strings 'n' things 28222 File Input and Output 290What's a file? 291Filenames 291File locations 292Opening a file 296Reading a file 297Text files and binary files 299Writing to a file 300Saving your stuff in files: pickle 303Game time again-Hangman 30523 Take a Chance-Randomness 313What's randomness? 313Rolling the dice 314Creating a deck of cards 319Crazy Eights 32324 Computer Simulations 336Modeling the real world 336Lunar Lander 337Keeping time 342Time objects 343Saving time to a file 347Virtual Pet 34925 What's Next? 358General programming 358Python 359Game programming and Pygame 359Other Python stuff 360Look around 362Appendix A Variable Naming Rules 363Answers to Self-Test Questions 365Chapter 1 Getting Started 365Chapter 2 Remember This-Memory and Variables 366Chapter 3 Basic Math 367Chapter 4 Types of Data 368Chapter 5 Input 369Chapter 6 GUIs-Graphical User Interfaces 371Chapter 7 Decisions, Decisions 372Chapter 8 Loop the Loop 374Chapter 9 Just for You-Comments 375Chapter 10 Game Time 376Chapter 11 Nested and Variable Loops 376Chapter 12 Collecting Things Together-Lists 377Chapter 13 Functions 379Chapter 14 Objects 380Chapter 15 Modules 382Chapter 16 Graphics 383Chapter 17 Sprites and Collision Detection 385Chapter 18 A New Kind of Input-Events 385Chapter 19 Sound 386Chapter 20 More GUIs 386Chapter 21 Print Formatting and Strings 387Chapter 22 File Input and Output 388Chapter 23 Take a Chance-Randomness 390Chapter 24 Computer Simulations 391Index 393