Python Projects for Kids
eBook - ePub

Python Projects for Kids

Jessica Ingrassellino

Share book
  1. 192 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Python Projects for Kids

Jessica Ingrassellino

Book details
Book preview
Table of contents
Citations

About This Book

Unleash Python and take your small readers on an adventurous ride through the world of programming

About This Book

  • Learn to start using Python for some simple programming tasks such as doing easy mathematical calculations.
  • Use logic and control loops to build a nice interesting game.
  • Get to grips with working with data and, once you're comfortable with that, you'll be introduced to Pygame, which will help you wrap up the book with a cool game.

Who This Book Is For

This book is for kids (aged 10 and over). This is book is intended for absolute beginners who lack any knowledge of computing or programming languages and want to get started in the world of programming.

What You Will Learn

  • Start fiddling with Python's variables, build functions and interact with users
  • Build your own calculator using the Math Library
  • Train Python to make logical decisions
  • Work with moving 2D objects on-screen
  • Understand the Pygame Library and build your very own game!
  • Write a cool program to manage inventories in your backpack

In Detail

Kids are always the most fast-paced and enthusiastic learners, and are naturally willing to build stuff that looks like magic at the end (when it works!). Programming can be one such magic. Being able to write a program that works helps them feel they've really achieved something. Kids today are very tech-savvy and cannot wait to enter the fast-paced digital world.

Because Python is one of the most popular languages and has a syntax that is quite simple to understand, even kids are eager to use it as a stepping stone to learning programming languages.

This book will cover projects that are simple and fun, and teach kids how to write Python code that works.

The book will teach the basics of Python programming, installation, and so on and then will move on to projects. A total of three projects, with each and every step explained carefully, without any assumption of previous experience.

Style and approach

The book will take a light approach in guiding the little readers through the world of Python. The main idea is to teach by example and let the readers have as much exercises to do, so that they learn faster and can apply their own ideas to the existing examples. The book should get them thinking, by the end, on where they can go next with such a powerful tool at their disposal.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Python Projects for Kids an online PDF/ePUB?
Yes, you can access Python Projects for Kids by Jessica Ingrassellino in PDF and/or ePUB format, as well as other popular books in Computer Science & Programming in Python. We have over one million books available in our catalogue for you to explore.

Information

Year
2016
ISBN
9781782175063
Edition
1

Python Projects for Kids


Table of Contents

Python Projects for Kids
Credits
About the Author
About the Reviewer
www.PacktPub.com
eBooks, discount offers, and more
Why subscribe?
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. Welcome! Let's Get Started
Python projects for you
What can you do with Python?
Why you should learn Python
The prerequisites of Python
Setting up your computer
For Mac and Ubuntu Linux users
Python 2.7
Terminal – the command line and the Python shell
Text editor
For Windows users
Command prompt
Text editor
Write and run your first program in the command line
Make yourself a work folder
A quick task for you
Summary
2. Variables, Functions, and Users
Variables
Naming variables – conventions to follow
What can variables remember?
Strings
Integers
Floating point numbers (floats)
Combining strings, integers, and floats
Functions
Built-in functions
Parts of a function
Users interacting with your program
Using the text editor and the command line
Build your own function – name()
Set up your project file
Begin your project
Writing code
Running your program
Going the extra mile
A quick task for you
Summary
3. Calculate This!
The calculator
Basic functions
Operations on two numbers
Convert data into numbers – int() and float()
Floating point to whole number conversion
Whole number to floating point conversion
Text strings fail in int() and float()
Creating our first calculator file
New functions – subtraction, multiplication, and division
Subtraction
Multiplication
Division
Finding a remainder – modulo
Running your program
A quick task for you
Summary
4. Making Decisions – Python Control Flows
Is it equal, not equal, or something else?
Conditional statements – if, elif, else
Getting better input
if
elif
else
Loops
while
Global variables and the quit() function
Using the quit() function
Using the while loop to control the program
for
Bonus – count_to_ten() function
A quick task for you
Summary
5. Loops and Logic
Higher or Lower
Game file set up
Importing libraries
Setting and initializing global variables
What is a Boolean?
Building the easy version
Compare numbers
play_again()
Start, stop, play again
start_game()
play_again()
Play testing
Building the hard version
Comparing numbers – the hard version
Play test the whole program!
A quick task for you
Summary
6. Working with Data – Lists and Dictionaries
Lists
Parts of a list
Working with a list
Changing the list – adding and removing information
Adding items to the list
Removing items from the list
Lists and loops
Dictionaries
Key/value pairs in dictionaries
Changing the dictionary – adding and removing information
Adding items to the dictionary
Changing the value of an existing item
Removing items from the dictionary
List or dictionary
A quick task for you
Summary
7. What's in Your Backpack?
Setting up our coding environment
Planning to program your game
Skills needed to make a program
Score, play again, or quit?
Getting and storing player information
Making a players list
Player profiles
Player profiles – how do they work?
Add players to profile
Adding items to the virtual backpack
Limiting items in a virtual backpack
Testing your code so far
A game loop
Bringing back the while loop
Comparing guesses with backpack items
Keeping score
Ending the game
Testing your game
A quick task for you
Summary
8. pygame
What is pygame?
Installing pygame
Installing pygame – Windows
Installing pygame – Mac
Installing Xcode
Installing Homebrew
Installing programs with homebrew
Installing pygame – Ubuntu Linux
Installing pygame – Raspberry Pi
pygame
Initializing pygame
Setting up the game screen – size
Setting up the game screen – color
Making stationary objects
while loop – viewing the screen
Making more shapes
Rectangle
Ellipse
Experimenting with shapes
More advanced shapes
Making moving objects
Moving objects with the keyboard
A quick task for you
Summary
9. Tiny Tennis
Introduction to game programming principles
The game plan
Creating an outline of game parts
Section 1 – imports, globals, and drawings
Importing libraries
Introducing globals
Defining a color
Adjusting the screen size
Drawing the screen
Creating screen labels
Ball – the starting location
Ball – setting the speed and direction
Ball – setting the size
Paddles – starting location and size
Initializing the score
Testing section 1
Section 2 – moving the paddles
Pre-loop actions
Creating the while loop
Moving the paddles – keyboard events
Exiting the game – escape key
Paddle control – player 1
Paddle control – player 2
The increase and decrease value (-= and +=)
Tes...

Table of contents