0% found this document useful (0 votes)
4 views2 pages

Python_Keywords_Reference

This document lists Python keywords along with their functions, providing a brief description of each keyword's purpose. Keywords such as 'True', 'False', 'if', 'for', and 'def' are included, highlighting their roles in programming logic, control flow, and function definition. The document serves as a quick reference for understanding the fundamental building blocks of Python syntax.

Uploaded by

i38726629
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

Python_Keywords_Reference

This document lists Python keywords along with their functions, providing a brief description of each keyword's purpose. Keywords such as 'True', 'False', 'if', 'for', and 'def' are included, highlighting their roles in programming logic, control flow, and function definition. The document serves as a quick reference for understanding the fundamental building blocks of Python syntax.

Uploaded by

i38726629
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Python Keywords & Their Functions

False: Boolean value representing falsehood.

True: Boolean value representing truth.

None: Represents the absence of a value or null.

and: Logical AND operator.

or: Logical OR operator.

not: Logical NOT operator (negation).

if: Used for conditional execution.

elif: Else if - another condition in an if chain.

else: Defines a block to run if the condition is false.

while: Repeats a block of code while a condition is true.

for: Loops over a sequence (like a list or string).

break: Exits the current loop early.

continue: Skips the rest of the loop body and continues with the next iteration.

in: Checks membership (used in loops and conditions).

is: Tests if two variables point to the same object.

def: Defines a function.

return: Exits a function and optionally returns a value.

lambda: Defines a small anonymous function (used for quick one-liners).

pass: Does nothing (used as a placeholder).

import: Imports a module.

from: Imports specific parts from a module.

as: Gives an alias to an imported module or variable.

class: Defines a class (used in Object-Oriented Programming).

try: Starts a block that will be tested for errors.

except: Catches and handles an error from a try block.


finally: Runs code after try/except, no matter what.

raise: Triggers a specified exception.

global: Declares a variable as global (outside function scope).

nonlocal: Declares a variable from the nearest outer scope (used inside nested

functions).

del: Deletes an object, variable, or item from a list/dictionary.

assert: Used for debugging; throws an error if a condition is false.

yield: Returns a generator object (used to pause/resume functions).

with: Wraps the execution of a block (commonly used with files).

await: Waits for a result in asynchronous code.

async: Declares an asynchronous function.

You might also like