Search This Blog

Wednesday, 15 December 2021

What are keywords in python and how to use them

 

Python Keywords

free portfolio web templates

There is one more restriction on identifier names. The Python language reserves a small set of keywords that designate special language functionality. No object can have the same name as a reserved word.

In Python 3.6, there are 33 reserved keywords

You can see this list any time by typing help("keywords") to the Python interpreter. Reserved words are case-sensitive and must be used exactly as shown. They are all entirely lowercase, except for False, None, and True. 

Trying to create a variable with the same name as any reserved word results in an error:
>>> for = 3
SyntaxError: invalid syntax

No comments:

Post a Comment

MongoDB - Tips, Tricks, and Deep Dive

Mastering MongoDB Geospatial Queries: A Practical Guide Location-based services are ubiquitous in today's applications, from ride-shar...