Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Python Projects for Kids

You're reading from   Python Projects for Kids Unleash Python and take your small readers on an adventurous ride through the world of programming

Arrow left icon
Product type Paperback
Published in Apr 2016
Publisher Packt
ISBN-13 9781782175063
Length 192 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Jessica Ingrassellino Jessica Ingrassellino
Author Profile Icon Jessica Ingrassellino
Jessica Ingrassellino
Arrow right icon
View More author details
Toc

Table of Contents (13) Chapters Close

Preface 1. Welcome! Let's Get Started 2. Variables, Functions, and Users FREE CHAPTER 3. Calculate This! 4. Making Decisions – Python Control Flows 5. Loops and Logic 6. Working with Data – Lists and Dictionaries 7. What's in Your Backpack? 8. pygame 9. Tiny Tennis 10. Keep Coding! A. Quick Task Answers Index

Functions


Once we have variables, we can use them to do some pretty interesting things. The most interesting thing is to build functions. Python functions are blocks of code that we can build to do a specific job. We build these functions once, and then we can reuse them in our code just by typing the name. This is really helpful. For example, if I need to write a program that adds two numbers (a calculator, for example), I do not want to have to write three or four lines of code every time I want to add two numbers. Instead, I want to write one function that can add two numbers together, and then use that single line whenever I need to add numbers.

Before we begin building functions of our own, we need to also know that Python has a lot of amazing functions that are built in. Some of Python's functions are things we will use all the time. Others we won't talk about in this book, but as you become a more skilled programmer, you will learn more about Python's built-in functions.

Built-in functions...

You have been reading a chapter from
Python Projects for Kids
Published in: Apr 2016
Publisher: Packt
ISBN-13: 9781782175063
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime