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

Conditional statements – if, elif, else


There are three language constructs that are used frequently in Python to control the outcome of a program. These constructs are if, elif, and else:

  • The if statement tells the program that if the user does this, then execute this part of the program.

  • The else statement is used to catch anything that the user does and is not in the program. For example, you can use if and else together: if the user chooses add, do addition, else do another action.

    Note

    The elif stands for else if, which means that if the first thing does not happen, then do the next thing in the list of possibilities until the user choice matches the possibility.

  • elif is used when you want to give the program more than two choices. You can use elif as many times as you like.

  • else is a signal of the end of the possible choices to your computer program. The else means that if none of the other things have taken place in your program, OR if the user has done something unexpected, then end...