Understanding Common Variable Types in Python | Beginner Lesson

LeMaster Tech
183 followers
357 Video Views·Apr 23, 2025
This is the best place to begin for absolute beginners looking to get started with Python.
Learn about different variable types inside python and some of the things you can use variables for in 7 minutes!
This is episode two in an introduction to python series coming from LeMaster Tech. Be sure to check out episode one if you missed it!
https://www.youtube.com/watch?v=iDHoUxpXBO4
Be sure to give us a like, drop a comment or subscribe to the channel for more content like this!
python download:
https://www.python.org/downloads/
pycharm download for windows:
https://www.jetbrains.com/pycharm/download/#section=windows
hello and welcome back to the channel
this will be
episode 2 in our python tutorial series
so if you missed the first one on
installing and setting up python and
pycharm go ahead and check that out i'll
link to it in this video
so in this video in particular we're
going to be taking a look at python
variables and data types
and a variable essentially if you've had
any exposure to math or programming this
should be fairly familiar to you but
it's basically taking a value a text
typically
and
storing data inside that so in python
the most common types of variables are
strings
integers
and booleans and the boolean may be the
one that's worth talking about a little
bit more here because a boolean is a
special type of
value that is true false so you can
store something that is either a one or
a zero as the computer sees it it's a
true or false
and by using a capital first letter and
the rest of the word of either true or
false you're telling the computer
that you're using a boolean
now these are the three most common
types of variable throughout this
tutorial we'll absolutely use a few
others numbers can be integers which are
basically
whole numbers
or floats which are decimal points and
you can do advanced math and fractional
computation using those
but for now
we'll put a few variables in here and
we'll show why you might want to use a
variable so if i have similar to what we
did in the previous video print
there
was a
man
wearing
a
hat and then i print
he
was 33
and then i print
was he old
yes
so if i run this what you're gonna see
in the console are the three sentences i
typed there was a man wearing a hat he
was 33. was he old yes just like we
typed in above but let's say
you want to be able to control what the
man was wearing how old he was
and set whether or not you consider that
old from variables rather than strings
well that's where we would be able to
use our various variables so rather than
a it's good to give it a descriptive
a descriptive variable name in this case
we'll use
clothing
and on the left of the equal sign you're
saying the variable name so this is the
variable name when you call the variable
you need to know this but on the right
you're actually putting the data in so
for now we'll say the clothing is a hat
just like we say down here
and then we'll call this
age
and then we'll say 33 just like we have
down here
and then we'll say
elderly
that'll be our variable controlling
whether or not we consider that old and
we'll set that oh you better spell it
right and we'll set that to true for now
so what you're going to find if in these
print statements
i replace
where we call these things out
with
the variables we just wrote then it's
going to display the exact same thing
because of the values we just set so the
way you do this
you use a plus sign in your print
statements and then to convert variables
that aren't strings
into strings you have to use an str
function so this is going to be
clothing and we actually can just leave
that as is because it's a string
but then this one we want to say he was
plus
age
and this is actually going to give us an
error i'll show you why
because
he was plus age can only concatenate
string not int so the issue that we're
having here is we're trying to say he
was which is a string and add a
numerical value to it and you can't do
that but don't worry python has a
built-in function str and then you put
your variable into parentheses that's
taking the value of your variable and
converting it to a string
so now if you see if i run this
there was a man wearing a hat he was 33
was he old yes
but
so we'll go ahead and do the same thing
for our elderly condition
and then you'll start seeing the value
of it right here so obviously nothing
has changed but if i want to say well
maybe he's not wearing a hat he's
wearing a
jacket
then you can change your variable you
don't have to change your print or
display function and you'll see right
away there was an old man wearing a
jacket he was 33 he was old i'm very
sorry anyone watching this who's 33 i
don't actually consider that old
but now the cool thing about python is
you could take all of this code all over
again and you can actually change your
variable values mid-run and say well
this guy's not wearing a jacket he's
wearing pants
this guy is
63 but for some reason we don't consider
him
elderly
so
what you're going to see if we run this
is we get our output twice there was a
man wearing a jacket he was 33 and he
was old but there was a man wearing
pants he was 63 and he was not old and
the interesting thing about variables
you're able to reuse and change
what the actual data inside of them is
multiple times as you go through
so this becomes very useful say when
you're creating calculators and you need
the inputs to change so the first time
you do a calculation you want a plus b
but the second time you might want a
divided by b and a and b can be
different numbers so one of the next
tutorials will be a calculator script
and you'll actually get uh some exposure
to that but for now you've been
shown string variables integer variables
and boolean variables as well as a
scenario where it might be useful to use
different variables so hopefully that
was a useful introduction to variables
inside python and stay posted as we do
more tutorials to come we'll get more in
depth and how to use these to do some
really cool functionality
as always thanks for watching uh feel
free to like and subscribe the channel
if you found it useful and stay tuned
for future tutorials thanks bye
