Welcome to AI Programming with Python

Start using AI techniques and developing skills related to programming, linear algebra, and neural networks.

Why Python Programming

Start coding with Python, drawing upon libraries and automation scripts to solve complex problems quickly.

Data Types and Operators

Control Flow

Functions

Scripting

Lab Classifying Images

In this project, learners will be testing their newly-acquired Python coding skills by using a trained image classifier. They will need to use the trained neural network to classify images of dogs (by breeds) and compare the output with the known dog breed classification. Learners will have a chance to build their own functions, use command line arguments, test the runtime of the code, create a dictionary of lists, and more.

NumPy

Learn how to use all the key tools for working with data in Python: Jupyter Notebooks, NumPy, Anaconda, Pandas, and Matplotlib.

Pandas

Matplotlib and Seaborn Part 1

Learn how to use Matplotlib to choose appropriate plots for one and two variables based on the types of data you have.

Matplotlib and Seaborn Part 2

Introduction

Learn the foundational math needed for AI success—vectors, linear transformations, and matrices—as well as the linear algebra behind neural networks.

Vectors

Linear Combination

Linear Transformation and Matrices

Vectors Lab

Linear Combination Lab

Linear Mapping Lab

Linear Algebra in Neural Networks

Introduction to Neural Networks

Gain a solid foundation in the latest trends in AI: neural networks, deep learning, and PyTorch.

Implementing Gradient Descent

Training Neural Networks

Deep Learning with PyTorch

Create Your Own Image Classifier

How Do I Continue From Here

02.2 Conditional Statements

If, Elif, Else

In addition to the if clause, there are two other optional clauses often used with an if statement. For example:

if season == 'spring':
    print('plant the garden!')
elif season == 'summer':
    print('water the garden!')
elif season == 'fall':
    print('harvest the garden!')
elif season == 'winter':
    print('stay indoors!')
else:
    print('unrecognized season')
  1. if: An if statement must always start with an if clause, which contains the first condition that is checked. If this evaluates to True, Python runs the code indented in this if block and then skips to the rest of the code after the if statement.
  2. elifelif is short for “else if.” An elif clause is used to check for an additional condition if the conditions in the previous clauses in the if statement evaluate to False. As you can see in the example, you can have multiple elif blocks to handle different situations.
  3. else: Last is the else clause, which must come at the end of an if statement if used. This clause doesn’t require a condition. The code in an else block is run if all conditions above that in the if statement evaluate to False.