python notes
🔹 Python – Overview
Python is a high-level, interpreted, object-oriented programming language.
Known for simple syntax, readability, and rapid development.
🔹 Key Features
Interpreted: Executes line by line.
Dynamically Typed: No need to declare variable types.
Object-Oriented: Supports classes, inheritance, polymorphism.
Extensive Libraries: NumPy, Pandas, Django, Flask, etc.
Portable: Runs on all major platforms.
Easy Syntax: Close to English language.
🔹 Basic Syntax
Example:
print("Hello, Python!")
Indentation defines blocks (no {} ):
if x > 10:
print("Greater")
🔹 Data Types
python notes 1
Numeric: int, float, complex
Sequence: list, tuple, range
Text: str
Mapping: dict
Set Types: set, frozenset
Boolean: bool
🔹 Core Concepts
Variables: Automatically typed
Functions:
def add(a, b):
return a + b
Loops: for , while
Conditional: if , elif , else
🔹 Python Collections
List – Mutable
Tuple – Immutable
Set – Unique values
Dictionary – Key-value pairs
🔹 OOP in Python
Class & Object
Inheritance
Polymorphism
python notes 2
Encapsulation
Abstraction
🔹 Error & Exception Handling
try:
x=1/0
except ZeroDivisionError:
print("Error!")
finally:
print("Done")
🔹 Popular Python Uses
Web development (Django, Flask)
Data science & ML (NumPy, Pandas, TensorFlow)
Automation / scripting
AI & Deep Learning
GUI apps
APIs & backend development
python notes 3