Skip to content

ADVERTISEMENT

Home » Blogs » Keywords & Identifiers In Python | Python Tutorial #2

Keywords & Identifiers In Python | Python Tutorial #22 min read

Keywords & Identifiers In Python

In this Post we will Learn About keywords & Identifiers(Names assigned to Variables, functions) In Python, So if you Have not Read the First Part of this Course you can Check it Out Here: Python Course | Getting Started With Python.

What are Keywords In Python?

ADVERTISEMENT

Keywords are reserved words in Python. We cannot use keywords as variable names, function names or any other identifiers. 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

All the Keywords are In Lowercase Except True, False and None.

Keywords In Python:

Falseawaitelseimportpass
Nonebreakexceptinraise
Trueclassfinallyisreturn
andcontinueforlambdatry
asdeffromnonlocalwhile
assertdelglobalnotwith
asyncelififoryield

So you can see the Table for All the Keywords Used In Python, We will be Using Most of them In Our Future Projects. So Now moving on to Python Identifiers.

Python Identifiers

Identifiers are names given to entities like classes, functions, variables, etc. It makes it possible to distinguish one entity from another.

Some Rules to Follow While Writing Identifiers:

1. The identifier can be a combination of lowercase (a-z) or uppercase (A-Z) letters or numbers (0-9) or the underscore _. Names like myClass, var_1 and print_this_to_screen are all valid examples.

2. Identifiers cannot start with a number. 1var is not valid, but var1 is a valid name.

3. Keywords cannot be used with Identifiers

4. We cannot use Special Characters like #,$,& with Identifiers

5. An identifier can be of any length

Things to Keep In Mind:

  • Python is a case-sensitive language that means In Python Programmer1 & programer1 are Two Different Variables.
  • To Seperate Long Tail Keywords start use of Underscore(‘_’) In your Code, Like mr_programmer_is_a_good_programmer.

So this was it For this Blog if you haven’t Read the Previous Make Sure to Read Here: Python Course | Getting Started With Python.

ADVERTISEMENT

Leave a Reply