Book Image

AI Crash Course

By : Hadelin de Ponteves
5 (2)
Book Image

AI Crash Course

5 (2)
By: Hadelin de Ponteves

Overview of this book

Welcome to the Robot World … and start building intelligent software now! Through his best-selling video courses, Hadelin de Ponteves has taught hundreds of thousands of people to write AI software. Now, for the first time, his hands-on, energetic approach is available as a book. Starting with the basics before easing you into more complicated formulas and notation, AI Crash Course gives you everything you need to build AI systems with reinforcement learning and deep learning. Five full working projects put the ideas into action, showing step-by-step how to build intelligent software using the best and easiest tools for AI programming, including Python, TensorFlow, Keras, and PyTorch. AI Crash Course teaches everyone to build an AI to work in their applications. Once you've read this book, you're only limited by your imagination.
Table of Contents (17 chapters)
16
Index

Functions

Functions are incredibly useful when you want to increase code readability. You can think of them as blocks of code outside the main flow of code. Functions are executed once they are called in the main code.

You write a function like this:

def division(a, b):
    result = a / b
    return result
d = division(3, 5)
print(d)

The first three lines are a newly created function called division, and the last two lines are part of the main code.

You can create a function by writing def and then writing the function's name. After the name, you put brackets and within them write the arguments of the function; these are some variables that you will be able to use inside of your function and are a part of the connection between the main code and the function. In this case, our function takes two arguments: a and b.

Then, once we enter our function, what we do is calculate a divided by b and call this division result. Then, in the last...