Help! Python Keywords
Python keywords are reserved words you cannot use when you are creating functions or variables. Keywords can potentially change with each version of Python, but you check your existing keywords using the help command:
help("keywords")
Try it in the interactive Python console below:
Here is a list of the Python keywords as of Python 3.10:
| False | class | from | or |
|---|---|---|---|
| None | continue | global | pass |
| True | def | if | raise |
| and | del | import | return |
| as | elif | in | try |
| assert | else | is | while |
| async | except | lambda | with |
| await | finally | nonlocal | yield |
| break | for | not |
You can learn more about each keyword by using the help command like so:
help("async")
Python async Help output
You can press enter to continue to the next line, and press Q to return to your interactive console.
It's important to not use these keywords when you're writing Python code. For example, you don't want to create a variable or function called "continue" because this is a Python keyword.
No comments yet. Add the first comment to start the discussion.