Keywords & Identifiers In Python

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

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?

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.

Tanmay Sinha

Author

  • Tanmay Sinha

    Founder & CEO of MrProgrammer.in | I help Learning Freaks to Step into the World of Programming and Our Mission is to Provide High Quality and Valuable Content to Our Users! We believe that everyone has the potential to learn to code, and we are committed to making that happen. Our courses are designed to be engaging and interactive, and we offer a variety of learning paths to meet the needs of all learners. We are also committed to providing our learners with the support they need to succeed, and we offer a variety of resources to help learners learn at their own pace. If you are interested in learning to code, we encourage you to check out our courses. We are confident that you will find our content to be high-quality, valuable, and makes sense.