The complete beginner's guide to Python, for young people who want to start today
Adventures in Python is designed for 11-to 15-year olds who want to teach themselves Python programming, but don't know where to start. Even if you have no programming experience at all, this easy to follow format and clear, simple instruction will get you up and running quickly. The book walks you through nine projects that teach you the fundamentals of programming in general, and Python in particular, gradually building your skills until you have the confidence and ability to tackle your own projects. Video clips accompany each chapter to provide even more detailed explanation of important concepts, so you feel supported every step of the way.
Python is one of the top programming languages worldwide, with an install base in the millions. It's a favourite language at Google, YouTube, the BBC, and Spotify, and is the primary programming language for the Raspberry Pi. As an open-source language, Python is freely downloadable, with extensive libraries readily available, making it an ideal entry into programming for the beginner. Adventures in Python helps you get started, giving you the foundation you need to follow your curiosity.
Start learning Python at its most basic level
Learn where to acquire Python and how to set it up
Understand Python syntax and interpretation for module programming
Develop the skills that apply to any programming language
Python programming skills are invaluable, and developing proficiency gives you a head start in learning other languages like C++, Objective-C, and Java. When learning feels like fun, you won't ever want to stop – so get started today with Adventures in Python.
Author(s): Craig Richardson
Publisher: Wiley
Year: 2015
Language: English
Pages: 282
Tags: Programming, Python
Title Page......Page 5
Copyright Page......Page 6
Publisher’s Acknowledgments......Page 8
About the Author......Page 9
Acknowledgments......Page 10
Contents......Page 11
What Is Programming?......Page 15
What Is Python and What Can You Do With It?......Page 16
What You Will Need for the Projects......Page 17
How This Book Is Organised......Page 18
Installing......Page 19
Opening......Page 21
Installing......Page 22
Opening......Page 23
Installing......Page 24
Opening......Page 27
Installing......Page 28
Opening......Page 29
Opening......Page 30
Creating Your First Program......Page 31
Conventions......Page 34
Reaching Out......Page 35
Adventure 1 Diving into Python......Page 37
What Is Programming?......Page 38
Opening IDLE......Page 39
Returning to Your First Python Program......Page 40
It Isn’t Working—Grrr!......Page 42
Using a File Editor......Page 44
Asking Questions with Variables......Page 47
A Bit About Variables......Page 49
Using Variables for a Fill-in-the-Blanks Story......Page 51
Using if Statements......Page 53
Nested if Statements......Page 55
Creating an Imaginary Vending Machine......Page 57
Using while Loops......Page 59
Infinite while Loops......Page 61
Praise Generator......Page 62
Set-Up and Password......Page 64
Using the Console to Do Things......Page 66
Getting Started with Turtle......Page 71
Using Variables to Change Angles and Lengths......Page 75
Using Addition to Draw a Spiral......Page 78
Saving Some Space with Loops......Page 79
A Shape with 360 Sides: Drawing a Circle......Page 81
Controlling the Number of Sides Using for Loops......Page 82
Changing the Fill Colour in a Shape......Page 85
Creating Functions to Reuse Your Code......Page 86
Shape Presets......Page 89
Adding Randomly Generated Pictures......Page 90
Adventure 3 Windows, Buttons, and Other GUI Stuff......Page 97
Creating Buttons......Page 98
Changing the Button Text on Click......Page 101
Counting Clicks......Page 102
Creating Text Boxes......Page 104
Writing It Backwards......Page 106
Adding Passwords......Page 107
Building a Random Sentence Generator......Page 110
Programming a Guessing Game......Page 113
Creating Sliders......Page 119
How Colours Work on Computers and as Hexadecimal Values......Page 123
Changing the Canvas Colour......Page 125
Making the Colour Picker......Page 127
Adding a Text Box......Page 130
Creating a Click Speed Game......Page 131
Installing PyGame......Page 137
My First PyGame......Page 138
Creating a Rectangle......Page 141
A Rainbow of Rectangles......Page 142
Colour Grid......Page 145
Wobbling Circle......Page 147
Saving a Single Image......Page 149
Saving a Series of Images......Page 150
Adventure 6 Adding Keyboard Input with PyGame......Page 153
Using Keyboard Input......Page 154
Creating the Game......Page 156
Introducing Full Movement......Page 160
Moving the Player Offscreen......Page 162
Adding the Ball......Page 164
Creating Collisions......Page 166
Goal!......Page 168
Adding a Time Limit......Page 171
Getting the Mouse Position......Page 175
Making a Button......Page 177
Moving Target......Page 180
Exploding Clicks......Page 183
Making a Mesh......Page 186
Creating Mouse Trails......Page 189
Loading an Image......Page 195
Layering Images......Page 198
Randomly Layering Images......Page 200
Adding a Moustache to a Photograph......Page 202
Creating a Walking Animation......Page 205
Walking in All Directions......Page 209
Teleportation......Page 211
Playing Sounds......Page 217
Creating a Noise Loop......Page 219
Making Keyboard Sound Effects......Page 221
Playing Music......Page 224
Adding Volume Tremolo......Page 226
Making a Music Player......Page 229
Adding Sounds and Music to a Game......Page 232
Adventure 10 Your Really Big Adventure......Page 237
Setting Up the Files......Page 238
Making the Game......Page 239
Walls......Page 240
Doors, Collisions and Coins......Page 243
Setting Up the Window and Variables......Page 245
Character Controls and Animations......Page 248
Displaying Points and Updating the Window......Page 251
Playing the Game......Page 252
Debugging the Game......Page 253
Summary......Page 254
Windows 8......Page 257
Mac......Page 259
Linux (Ubuntu)......Page 261
Windows 8......Page 262
Mac......Page 263
Raspberry Pi......Page 264
Glossary......Page 265
Index......Page 271
EULA......Page 282