Complete Python Notes
1. Introduction to Python
Python is a high-level programming language. It is easy to read and write. It runs line by line (interpreted la
2. Variables
Variables store data. Example:
name = 'Kunal'
age = 15
3. Data Types
String (text), Integer (whole number), Float (decimal), Boolean (True/False).
4. Input and Output
Output: print('Hello')
Input:
name = input('Enter your name')
5. Operators
Arithmetic: + - * / %
Comparison: == != > <
Logical: and or not
6. Conditional Statements
Used for decision making.
Example:
if age >= 18:
print('Adult')
else:
print('Minor')
7. Loops
For loop and While loop are used to repeat code.
Example:
for i in range(5):
print(i)
8. Data Structures
List, Tuple, Set and Dictionary are used to store multiple values.
9. Functions
Functions are reusable blocks of code.
Example:
def greet(name):
print('Hello', name)
10. OOP (Object Oriented Programming)
OOP uses Class and Object to organize code.
Example:
class Student:
def __init__(self, name):
[Link] = name
11. File Handling
Used to read and write files using open(), read(), write() functions.
12. Exception Handling
Used to handle errors using try and except blocks.
13. Modules
Modules help reuse code.
Example:
import math
print([Link](16))
14. Advanced Python
Lambda functions, List comprehension, Generators, Decorators, Multithreading, Async programming.
15. Important Libraries
Web: Django, Flask
Data Science: NumPy, Pandas, Matplotlib
Machine Learning: TensorFlow, PyTorch