Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
76 views

Python Notes for CBSE Class 12

These notes provide a structured overview of essential Python concepts for CBSE Class 12, including programming modes, data types, operators, functions, data structures, object-oriented programming, inheritance, and memory management. Key topics such as namespaces, scope, and special class methods are also covered. The document is designed to aid students in understanding Python in a clear and concise manner.

Uploaded by

Rahul Gupta
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)
76 views

Python Notes for CBSE Class 12

These notes provide a structured overview of essential Python concepts for CBSE Class 12, including programming modes, data types, operators, functions, data structures, object-oriented programming, inheritance, and memory management. Key topics such as namespaces, scope, and special class methods are also covered. The document is designed to aid students in understanding Python in a clear and concise manner.

Uploaded by

Rahul Gupta
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/ 3

These notes are well-structured and cover essential Python concepts for CBSE Class 12 in an easy-to-

understand way. Below is a slightly revised and better-formatted version for clarity and readability:

Python Notes for CBSE Class 12

Modes of Python Programming


1. Interactive Mode: Allows interaction with the Operating System. Commands are executed line by
line.
2. Script Mode: Python programs are written in files and executed using the interpreter.

Basic Data Types


1. Number: Stores numerical values (e.g., integers, floats).
2. Sequence: An ordered collection of items indexed by positive integers.

Operators in Python
1. Arithmetic Operators: `+`, `-`, `*`, `/`, `%`, `**`, `//`
2. Relational Operators: `<`, `<=`, `>`, `>=`, `!=`, `==`
3. Logical Operators: `or`, `and`, `not`
4. Assignment Operators: `=`, `+=`, `-=`, `*=`, `/=`, `%=`, `**=`, `//=`

Functions and Modules


1. Functions: A named sequence of statements performing computations.
2. Module: A file containing Python definitions and statements, extending Python’s standard library.

Data Structures
1. String: A sequence of characters accessed using indexes.
2. List: A sequence of values of any type.
3. Dictionary: Stores key-value pairs where keys can be of any data type.
4. Tuple: An immutable sequence of values indexed by integers.

Namespaces and Scope


1. Namespace: Mapping of names to objects (e.g., global, local, built-in).
2. Scope: Region where a variable or name is accessible.
3. LEGB Rule:

Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 1/3
L: Local (current function)
E: Enclosing functions (inner to outer)
G: Global (module level)
B: Built-in (Python-defined names)

Object-Oriented Programming
1. Class: A blueprint for creating objects.
`__init__`: Initializes class members.
`self`: Refers to the instance of the class.
2. Attributes:
Class attributes: Shared by all instances.
Instance attributes: Specific to individual instances.
3. Methods:
`getattr()`: Access an attribute.
`hasattr()`: Check if an attribute exists.
`setattr()`: Set an attribute with a value.
`delattr()`: Delete an attribute.

Special Class Methods


1. `__dict__`: Returns the dictionary of the class namespace.
2. `__doc__`: Returns the class’s docstring.
3. `__name__`: Gives the class name.
4. `__module__`: Specifies the module where the class is defined.
5. `__bases__`: Tuple containing base classes.
6. `__del__`: Invoked when the object is deleted.
7. `__str__`: Returns a string representation of the object.

Inheritance
1. Single Inheritance: Subclass inherits from one base class.
2. Multilevel Inheritance: Subclass acts as a base for another class.
3. Multiple Inheritance: Subclass inherits from multiple base classes.
4. Hierarchical Inheritance: Multiple subclasses inherit from one base class.
5. Hybrid Inheritance: Combination of multiple inheritance types.

Overriding Methods

Enables customization of parent class methods in the subclass.

Abstract Methods

Declared in a parent class but implemented in the subclass.

Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 2/3
Memory Management
1. Reference Counting: Tracks the number of references to an object. When the count is zero, the
object is deleted.
2. Garbage Collection: Reclaims unused memory blocks automatically.

This concise and well-organized version is suitable for CBSE Class 12 students preparing for Python-
based concepts. Let me know if you need more topics or detailed explanations!

Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 3/3

You might also like