0% found this document useful (0 votes)
11 views3 pages

CLASS 12 A Notes

The document lists 24 important keywords in Python including False, True, None, if, else, for, while, def, return, import, try, except, finally, class and others. These keywords are fundamental to understanding the structure and behavior of Python programs.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views3 pages

CLASS 12 A Notes

The document lists 24 important keywords in Python including False, True, None, if, else, for, while, def, return, import, try, except, finally, class and others. These keywords are fundamental to understanding the structure and behavior of Python programs.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

CLASS 12 A IMPORTANT NOTES

Informatics Practices Code 165

Important Keywords

Informatics
Practices Code
165

Here are some important keywords in Python:

1. *False:* Boolean value representing false.

2. *True:* Boolean value representing true.

3. *None:* Represents the absence of a value or a null value.

4. *and:* Used as a logical operator to combine multiple


conditions, resulting in true only if both conditions are true.

5. *or:* Another logical operator used to combine multiple


conditions, resulting in true if at least one condition is true.

6. *not:* A logical operator used to negate the value of a boolean


expression.

7. *if:* Introduces a conditional statement that executes a block of


code if a specified condition is true.

8. *else:* Part of a conditional statement that specifies the block


of code to be executed if the condition in the if statement is false.

9. *elif:* Stands for "else if" and is used to introduce additional


conditional statements in a chain of if-else blocks.
10. *for:* Initiates a loop that iterates over a sequence of elements
(e.g., a list, tuple, or string).

11. *while:* Introduces a loop that continues to execute a block of


code as long as a specified condition is true.

12. *def:* Used to define a function in Python.

13. *return:* Used in a function to specify the value to be returned


after the function is called.

14. *import:* Allows the inclusion of modules or packages in a


Python program. It is used to access the functionality of external
libraries.

15. *from:* Often used in combination with import to specify which


module or specific elements from a module should be imported.

16. *as:* Can be used with import to assign a different name to


the imported module or elements for ease of use.

17. *class:* Used to define a new class in Python, which serves


as a blueprint for creating objects.

18. *try:* Initiates a block of code for exception handling, where


potential errors are anticipated and handled.

19. *except:* Part of the try-except block, used to specify the code
to be executed if a particular exception occurs.

20. *finally:* Introduces a block of code that is guaranteed to be


executed after a try-except block, regardless of whether an
exception occurred.

21. *raise:* Used to explicitly raise an exception in a Python


program.

22. *assert:* A debugging aid that tests a condition as true. If the


condition is false, an assertion error is raised.

23. *global:* Indicates that a variable inside a function has global


scope, meaning it can be accessed and modified throughout the
program.

24. *nonlocal:* Specifies that a variable inside a nested function


(a function defined within another function) is not local to the inner
function, allowing it to be modified.

These keywords are fundamental to understanding the structure


and behavior of Python programs. If you have any specific
questions about these keywords or if you want to delve deeper
into any of them, feel free to ask!

You might also like