What are python reserved keywords?
When coding in the Python language there are particular python reserved words that the system uses, which cannot be accessed as a variable or a function as the computer program uses them to perform specific tasks.
When you try to use them, the system will block it and throws out an error. Running the below code in Python
import keyword keywordlist = keyword.kwlist print(keywordlist)
Produces the below keyword values
['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']
When writing your code, it is important to follow the following guidelines:
(A) Research the keywords first for the language you are writing in.
(B) Ensure that your programming language highlights keywords when used, so you can fix the issue.
(C) Setup your computer program in debug mode to highlight keywords use.
With some programs running into thousands of lines of code, with additional functions and variables, it can become harder to spot the problem, so good rigour in the initial stages of coding will help down the road any issues that you may find that need to fixed.
This code was run in Python version 3.8