An ad-free and cookie-free website.
Videos can also be accessed from our Full Stack Playlist 3 on YouTube.
Introducing Python keywords | Python for Beginners (4:52)
Welcome. Today's question: What are the top 5 keywords for beginners?
I'm Paul, and I create five minute videos to help people help themselves, because it's so easy to forget words in a new language.
So here we will find that list of keywords from the last tutorial, and start exploring these reserved words in Python, like operators.
False, the focal point of conditional
logic in programming.
Then we will play with
not operators before moving on to
(Commands in Linux)
(Keywords and functions in Python)
Let's head to the Linux Terminal, and currently I'm using Python version 3.4.2.
Online documentation can be found at https://www.python.org/doc/versions/ by version number.
Now let's find those keywords locally.
Here is a file with the 33 Python keywords, and I'll use this file in the future so we can keep track of our progress, including five in this tutorial (number 29).
Below that are instructions for how to access this list in Python yourself, which is often less distracting than a Google search, right?
The last tutorial demonstrated how to access documentation on the local machine using interactive help and object help.
python3, then type
help to identify the two types.
First, interactive help, using
like this and it gives you a different command prompt.
keywords and there they are in
alphabetical order, the first three starting with capital letters.
To return to a Python prompt, type
Now, object mode, accessed from here, using
help and an object like a function
q to return to the Python
Or a topic like
'keywords' in single
So what should we know about reserved words called keywords?
First, they must be used with exact spelling, so
true creates an error.
Second, you don't want to name variables using keywords, so yes,
'the sky is blue' is
true, lowercase true.
We can't name it
True, capital True
or Python yells at you.
And third, which illustrates why compatibility can be an issue, keywords do change across versions in Python. Keep that in mind.
False are Boolean values, or outcomes
from comparison or relational operators in Python.
Logical programs follow this
False path, and they translate to
True == 1?
Ah, so then
False == 0, right?
And here's an odd one, what is
True + True.
Not four, it's two.
And we went through an exercise with operators like this back in
tutorial 24. Remember
1 < 2?
1 is not equal to
So if we did
1 is less than
1 is greater than
So the takeaway,
True is 1,
False is 0.
Let's move on to
and, which means
that all operands must be
order for the whole statement to be
True and True is
True and False is
False and True is
False and False?
Next is the
or keyword. Here the
whole statement is
True if any of the
True or True is
True or False is
False or True is
False or False?
False. We can't overthink it.
not goes like this.
not True it's
False. That's basic. And if it's
not False it's
And if you wanted to program like a lawyer, and confuse everyone, you
might do a
not not not False,
So to help, here are a few tables. Stick with it until you can generate these from memory.
Below is a homework problem. Pause here and write it down.
Here is where we are heading on our journey, using this software stack.
You are invited to join, simply Subscribe to get new videos and up next we cover functions used for text.
Have a nice day.
For reminders of new content follow @factorpad on Twitter, our email list or subscribe on YouTube.
A newly-updated free resource. Connect and refer a friend today.