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

Users interacting with your program


We just built a function that adds two numbers together. Learning to make a program that does math is interesting, but our function is limited because our addition() function needs to have variables changed manually to calculate results for different numbers.

What if there was a way to get information from the user and store THAT information in a variable so that it could be used by addition or subtraction functions each time? Anyone who has used a calculator of any kind already knows that this is possible. Python has a function called raw_input() that allows us to tell the program to ask the user a question. The raw_input() function is incredibly useful. We can get every kind of information from the user this way, and we can make interactions between the user and the computer based on the user input.

We can use the Python shell to test how the raw_input() function works. Try typing these two lines of code into your Python shell:

  name = raw_input('What...