[MUSIC].
So, we've done those things.
I'm gonna go continue editing, so I double click again.
And now next, what we're gonna do is
create some variables in Python.
Shift-enter, and now we're back to the next cell.
Now, Python is a scripting programming language, just like many
other scripting language out there, which makes it really easy to prototype things.
And we will also see today some machinery tools that make it easy to run machinery
algorithms at scale, even within the simple programming language like Python.
But for now, let's just start with the simple programming language.
So, Python is a scripting language, and you can create variables as you go.
You don't have to declare them formally, and you don't have to declare their types.
So for example, if I say, I = 4,
what I get out of this is an integer as we will see.
So, comments in Python can be done in various ways.
So for example, I can put just a pound sign here,
#int, and just to tell me that i that I just created is an integer.
And in fact, you can type type(i), and it will print its type,
and you'll see that you have an int.
Now, I can just create a new variable.
Let's call it f = 4.1 and now f is gonna be a float.
So, the type of f is float.
You can make integers, you can make floats,
you can also make all sorts of other types of variables.
So, for example,
b = true makes a Boolean variable.
Whoa, I can't spell variable.
And if I say, for example, s =, I said single quotes can be strings,
also double-quotes can be strings, so let's say double quotes.
This is the string.
Shift enter, we now have a string.
So for example, if I print s, I have a string.
Now this is the basic Python types.
Now, let's look at some more advanced Python types.
So I told you how to create a text cell by going to the cell menu,
and going to Cell Type, and clicking on Markdown.
Another way they can do it,
if I'm in a cell I can hit Esc m, and it creates a markdown cell.
I had to press enter to edit it.
So now that we've talked about basic types,
let's talk about some advanced Python types.
So what are some common advanced Python types?
Okay, so most common one is what's called a list.
So let's say l is a list for example, 3, 1, 2, just a list of numbers,
integers, floats, strings, anything can be formed into lists.
In fact, Python loves lists so if you, and you can print it.
Print L. You'll see that we get a list back.
So this type here is called a list.
Now, you can also have other types which are called dictionaries.
Dictionaries are, you can think about it kind of like hash tables with keys.
So, for example there's a dictionary.
We can have let's say two entries in the dictionary,
maybe foo, we'll put foo,
is the name of the entry, :1, so the entry is one.
Comma, I'm gonna create another entry.
Say, bar.
And then let's say that takes value 2.3, so that's a float.
And we can take another entry,
let's call that S and
the entry is my first dictionary.
And now we've create a dictionary with three fields with different types.
So for example, if you just print d,
you'll see the dictionary box that created.
Not that the elements aren't in the same order because they're unordered inside
the dictionary.
I can access an element so for example, if I print d['foo'],
you'll see that get's value 1.
Dictionary is extremely useful.
So now we talked about listen dictionaries.
One last thing,
that it's important to note is that Python's note type is called none.
So, for example if we say, n is equal to,
oops, I pressed enter too quickly, sorry about that.
If we say n is equal to none, we now have something that has a NoneType.
So type of n is NoneType.
So those are the more advanced types in Python and let's talk about
little bit of ways we can print more advanced printing and typing.
And then we're going to go into loops, conditional statements, and
defining functions.
So let's start with slightly more advanced printing so
I'm going to press ESC M and write Advanced printing.
And so that's what we're doing now, and now,
it's not just printing a single variable.
I'm gonna print the string where you're gonna
insert some variables in it, so for example,
I'm gonna print the string, our float value is %s.
So that's when I insert,
we're gonna later on insert the variable F that we defined above in that %s.
And we're gonna say
our int value is %s.
And now inserting, you just put a percent at the end of the string.
And we're gonna insert f and i.
So this is what this parenthesis, it's called a tuple, inserts f, here,
this f in the first percent s and the i in the second percent s.
So, if I just you see that our float value is 5.1, and our integer value was 4.
And you can do all sorts of more advanced string transformations,
which you should go explore on your own,
cuz it's extremely fun, and we really benefit from using Python.
It's really a simple, easy to prototype, fun programming language.
I really love it.
[MUSIC].