Python Programming for Kids
(by Dr. Z)
Python is a very popular programming language that lets you work more quickly and integrate your systems more efficiently.
● Python is a general purpose programming language
● Python is a high level programming language
● Python is portable (runs everywhere)
● Python is an interpreted language
● Python is strongly typed
● Python has a huge set of libraries
● Python is friendly & easy to learn
● Python is Open, aka completely free
Application types you can create with Python
● Web Applications
● Android Applications
● Scientific Applications
● System Administration Applications
● Console Applications
Famous software created with Python
This class is designed to teach computer programming using the Python language. The goal is to introduce students to the Python language and its ecosystem. After this introduction level class, students will be able to continue exploring Python on their own.
To reach this goal, we’ll start with the basics (expressions, statements, data types, variables, conditionals, loops and libraries). We will learn Python programming by writing elegant syntax, making our programs easier to read and efficiently solve the problem as expected.
We will also work our way up to advanced concepts, such as lists/arrays, dictionary, exception/error handling, etc.
To make it more interactive and allow us to immediately see our programs’ outputs, we will use the Jupyter Notebook. It provides visualization and interactive coding along with markdown text notes explaining the progress of the programs.
Jupyter Notebook is run inside the web browser, so it will work on Mac, Windows and Linux computers.
Python building blocks
This will be the real core part of this class. We will go through in much more detail the fundamental programming language components of Python through interactive code examples in REPL.
● anything that has a value, e.g., 3, 4 + 5, “Hello”
● a set of instructions given to a computer to perform operations (single line or multiple lines of code)
● explain code
● prevent code lines to be executed
● single line (#) or multi-line comments(“””lines of comments”””)
Python Data Types
● numbers (integers/int and floating points/float)
● strings (str)
● boolean (bool)
● type(x) gets the type of the data x
casting data types
e.g., int(3.14) -> 3
● float(3) -> 3.0
● named containers for storing data values
● A variable in Python are created when you assign a value to a named container
● Variable names can start with a letter or the underscore character (_), cannot start with a
● Variable names are case sensitive
● Spaces are not allowed in variable names
● Short and descriptive variable names are the best
● Python has reserved keywords:
● arithmetic operators:
+, -, * /, %
● assignment operators:
=, ++, -=, *=, /=, %=
● comparison operators:
==, !=, >, <, >+, <=
● logical operators:
and, or, not
● if-else, if-elif-else
short hands (one-line if statements)
if a > b: print(“a is greater than b”)
print(“A”) if a > b else print(“B”)
● print(“A”) if a > b else print(“=”) if a == b else print(“B”)
if with and/or
if a > b and c > a:
● if a > b or c > a:
● for loops (iterate over a given sequence, more like an iterator method)
● while loops (execute a set of statements as long as the condition after while is true)
● break statement
● continue statement
● range function
● A function is a block of code which only runs when it is called.
● You can pass data, known as parameters, into a function.
● A function can return data as a result.
I have created a Jupyter Notebook file that describes fundamental building blocks or concepts for general programming. I will illustrate with specific Python code examples. I am inserting below the screenshots of that Jupyter Notebook here not only to lay out the course outline, but also to show potential students what the Python programming environment will be like
Students will be able to run all the code in the REPL cloud environment if they choose to avoid installing Anaconda and/or Jupyter Notebook on their computers.