You are on page 1of 2

001 - KEYWORDS AND IDENTIFIERS

February 29, 2020

1 Python Keywords
Keywords are the reserved words in Python.
We cannot use a keyword as a variable name, function name or any other identifier.
They are used to define the syntax and structure of the Python language.

In Python, keywords are case sensitive.

There are 33 keywords in Python 3.7. This number can vary slightly in the course of time.

All the keywords except True, False and None are in lowercase and they must be written
as it is. The list of all the keywords is given below.

False class finally is return


None continue for lambda try
True def from nonlocal while
and del global not with
as elif if or yield
assert else import pass
break except in raise

2 Python Identifiers
An identifier is a name given to entities like class, functions, variables, etc.
It helps to differentiate one entity from another.

2.0.1 Rules for writing identifiers


1 - A variable name consists of alphabets (a to z) and (A to Z), Digits(0 to 9) or
an underscore _.
2 - You cant start a variable name with a digit.
3 - Use underscore if you want to create a variable name having two or more words.

Good Variable Name: number, salary, first_name, numebr1

2.0.2 Things to Remember


Python is a case-sensitive language.

1
This means, Variable and variable are not the same.
Always name identifiers that make sense.

While, c = 10 is valid. Writing count = 10 would make more sense and it would be
easier to figure out what it does even when you look at your code after a long gap.

Multiple words can be separated using an underscore, this_is_a_long_variable.

[ ]:

[ ]:

ALI RAZA
Research Assistant
2020 All rights reserved.

You might also like