0% found this document useful (0 votes)
12 views

Neat_Python_Notes_CBSE_Class_11_12

Uploaded by

DEADLY GAMER
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)
12 views

Neat_Python_Notes_CBSE_Class_11_12

Uploaded by

DEADLY GAMER
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

Python Notes for Class 11 and 12 CBSE

Introduction to Python

Python is a high-level, interpreted programming language with simple syntax and powerful libraries.

Variables and Data Types

Variables store data values.


- int: Integer values (e.g., 10).
- float: Floating-point values (e.g., 10.5).
- str: String values (e.g., "Hello").
- bool: Boolean values (True or False).
- list: Ordered collection (e.g., [1, 2, 3]).
- tuple: Immutable ordered collection (e.g., (1, 2, 3)).
- dict: Key-value pairs (e.g., {"name": "John", "age": 25}).

Operators

Arithmetic Operators: Perform mathematical operations (+, -, *, /, %, //, **).


Comparison Operators: Compare values (==, !=, >, <, >=, <=).
Logical Operators: Combine conditional statements (and, or, not).

Input and Output

input(): Gets input from the user.


print(): Displays output to the console.

Control Structures

if: Executes a block of code if the condition is true.


if-else: Executes one block of code if the condition is true, another if false.
if-elif-else: Checks multiple conditions.

Loops
Python Notes for Class 11 and 12 CBSE

for: Iterates over a sequence.


while: Repeats as long as the condition is true.
break: Exits the loop.
continue: Skips the current iteration.

Functions

def: Defines a function.


return: Sends back a result from a function.

Object-Oriented Programming (OOP)

class: Blueprint for creating objects.


__init__(): Constructor method, initializes attributes.

Modules and Packages

import: Includes external Python files.

Exception Handling

try-except: Catches and handles errors.


finally: Executes code regardless of the result.

File Handling

open(): Opens a file.


read()/write(): Reads from or writes to a file.
close(): Closes the file.

Python Libraries

NumPy: Numerical computations.


Pandas: Data manipulation.
Python Notes for Class 11 and 12 CBSE

Matplotlib: Data visualization.

Strings

Concatenation, slicing, indexing.


Methods: lower(), upper(), find(), replace(), split(), join().

Lists

Methods: append(), insert(), remove(), pop(), sort(), reverse().

Dictionaries

Methods: keys(), values(), items(), get().

Data Visualization

Using Matplotlib for plots.

Data Handling

Reading CSV files with Pandas.

You might also like