keyword in Python:
- Keywords are special reserved words that are part of the language itself. They define the rules and structure of Python programs which means you cannot use them as names for your variables, functions, classes or any other identifiers.
Getting List of all Python keywords
import keyword
keyword.kwlist
keywords:
['False', 'None', 'True', 'and', 'as', 'assert', 'async', 'await', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'nonlocal', 'not', 'or', 'pass', 'raise', 'return', 'try', 'while', 'with', 'yield']
import → loads the module.
keyword → the module name.
kwlist is a list that contains all Python keywords.
Python Data Types
- Data types in Python define the type of value stored in a variable and determine the operations that can be performed on that data. Since Python treats everything as an object, each value is associated with a specific data type.
| Data Type | Example |
|---|---|
int |
10 |
float |
10.5 |
str |
"Hello" |
bool |
True |
list |
[1, 2, 3] |
tuple |
(1, 2, 3) |
set |
{1, 2, 3} |
dict |
{"name": "Vinoth"} |
NoneType |
None |

Top comments (0)