>> Hello everyone, and welcome back to intro to
Python here on cybrary on demand.
You are watching Lesson 7,
the final lesson of Module
1 and you're watching it here with me,
your instructor Joe Perry.
Today in Lesson 7,
what we're going to cover are the four Python datatypes.
There're actually more than four Python data types,
but these are the four we're going to worry about,
strings, numbers, lists, and dictionaries.
We're going to try and do this all in one fell swoop.
We're going to just run through each of them.
Each of these, by the way,
is actually going to be the subject of
its own lesson in Module 2.
Strings, numbers, lists, and dictionaries all going to
deep dive lesson in Module 2.
Don't worry too terribly much if you don't
necessarily know how to
use all of them at the end of this video,
most of them are just there so that
we know what they are and to
familiar with them when we see
them in the code for the next module.
The first example, strings,
you may remember from our variables lesson,
variables are Tupperware for your brain.
They're just places to store data.
Strings and Python are denoted rather by using quotes,
either double or single quotes.
In this case, you can write something, for example,
we are in the knights who say ni.
If you don't know that reference that as
a money Python reference.
In fact, in the name of the Python programming language,
if I didn't mention it before,
is actually a reference to Monty Python.
You're going to see a lot of jokes
about Monty Python when you're going
through code and documentation
and tutorials for this language.
X is now the string,
we are the Knight's who say, ni,
we can print x as we've done with
Hello World and it will work just fine.
In fact instead of doing prints, Hello World,
[NOISE] we could have
simply set that string equal to a variable
[NOISE] and printed it that way.
Now it's worth noting that in a lot of cases,
people will want to just print the string directly.
It's not a terrible situation to do that in Python.
Python's are relatively memory safe language,
so you can usually get away
with directly printing strings.
But when you're working with some modules,
for example, SQL,
you usually want to interpret it
through a variable because there are ways
that you can implement security by
using the variable instead
of just using the string directly.
Then of course, having variables where people can
store input strings is always essential.
Wrong command, those are strings.
Now we're going to go ahead and we're going to talk
about numbers in Python.
Numbers in Python work
exactly the same way that strings do,
except that they are created without quotes.
If you're familiar with other languages,
you may know that in,
for example, C there are
a whole bunch of different types of number.
There are integers, there are floats.
There are bools which are actually
just numbers and C. There are bools,
there are longs, there are doubles,
there are words, there are quad words.
All sorts of different types of number in Python,
those are all abstracted out and you just have numbers.
You can have z equals 1.24,
you can have w equals 14/2 anything.
Of course that will actually evaluate
out and just perform seven.
Now you'll notice that that seven has
a decimal like the 1.24 did,
but neither of these numbers had that.
That's because division in Python automatically
assigns a float under the hood.
It's still usable as a normal Python number,
but you will see the decimal place because Python
is interpreting it as a float,
which is an integer with decimal places.
You can do math and Python.
I actually often use Python
just for math because it's often
faster than finding the calculator and opening that up.
For example, seven to the 13th power,
you can find what seven star, star 13.
You can do normal addition.
Not what I meant to do there.
You can do subtraction, and of course,
you can store the result of these things in variables.
Numbers in Python, pretty straightforward.
You're going to use those all the time as I mentioned,
they're often used for control values or
to interpret menus or for other things.
But that's all numbers are in Python.
Now, in the next video,
because we're going to run up against our time here,
in the next video, we're going to discuss
the next two Python datatypes,
lists and dictionaries and those are
two abstracted data types
we're going to spend a little bit of time on.
Thank you for watching. As always,
I'm your instructor Joe Perry.
I'm very happy to have you here in
intro to Python on cybrary on demand.