Book Image

Python Projects for Kids

By : Jessica Ingrassellino
Book Image

Python Projects for Kids

By: Jessica Ingrassellino

Overview of this book

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.
Table of Contents (18 chapters)
Python Projects for Kids
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Dictionaries


Dictionaries are a different way to organize data. At first glance, a dictionary may look just like a list. However, dictionaries have different jobs, rules, and different syntax than lists.

Parts of a dictionary like lists, dictionaries have different parts that need to be used to make them work—names, use curly braces to store information. For example, if we wanted to make a dictionary called numbers, we would put the dictionary entries inside curly braces. Here is a simple example to type into your Python shell:

numbers = {'one': 1, 'two': 2, 'three': 3}

Key/value pairs in dictionaries

As you can see in the previous screenshot, the dictionary stores information with things called keys and values. In a dictionary of items, for example, we might have keys that tell us the names of each item and values that tell us how many of each item we have in our inventory. Once we store these items in our dictionary, we can add or remove new items (keys), add new amounts (values), or change...