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:
False | await | else | import | pass |
None | break | except | in | raise |
True | class | finally | is | return |
and | continue | for | lambda | try |
as | def | from | nonlocal | while |
assert | del | global | not | with |
async | elif | if | or | yield |
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.
- The JS Developer’s Podcast [EP: 2] Variables and Data Manipulation - October 15, 2024
- YouTube Channels to Learn Coding: Top 9 Picks That Will Make a You Master - October 10, 2024
- The JS Developer’s Podcast [EP: 1] Introduction to JavaScript - September 27, 2024
Pingback: Python Statement, Indentation and Comments | Python Course #3 - Mr Programmer
Pingback: Python Data Types | Python Course #5 - Mr Programmer
Pingback: Python Tutorial #1 | Getting Started With Python - Mr Programmer