BCA Python Full Notes (All Units)
================ UNIT 1 =================
Introduction to Python:
Python is a high-level, interpreted, general-purpose programming language.
It is easy to learn and widely used in web development, data science, AI.
Features:
- Easy Syntax
- Interpreted Language
- Object Oriented
- Portable
- Open Source
- Large Libraries
Example:
print("Hello World")
Data Types:
int, float, complex, string, list, tuple, set, dictionary
Example:
x = 10
y = 10.5
name = "Python"
Input/Output:
input() and print()
Operators:
Arithmetic, Relational, Logical, Assignment
================ UNIT 2 =================
Control Structures:
if, if-else, nested if
Example:
if x > 10:
print("Big")
else:
print("Small")
Loops:
for loop, while loop
Example:
for i in range(5):
print(i)
Data Structures:
List (mutable), Tuple (immutable), Set (unique), Dictionary (key-value)
================ UNIT 3 =================
Functions:
Reusable block of code
Example:
def add(a,b):
return a+b
Types:
Built-in, User-defined, Lambda
Recursion:
Function calling itself
Modules:
Collection of functions
Example:
import math
print([Link](16))
================ UNIT 4 =================
Exception Handling:
Handles runtime errors
Types:
ZeroDivisionError, ValueError, TypeError
Example:
try:
a = 10/0
except ZeroDivisionError:
print("Error")
Finally Block:
Runs always
User-defined Exception:
class MyError(Exception):
pass