π PYTHON β DAY 32 STUDY MATERIAL
β¨ Topic: OOP β Special (Magic / Dunder) Methods
βββββββββββββββββββ
π What are Magic (Dunder) Methods?
Magic methods are special methods that start and end with double underscores:
Example:
init
str
len
They allow us to define behavior for built-in operations.
βDunderβ = Double Under ( __ )
βββββββββββββββββββ
πΉ init Method
Constructor method
Automatically called when object is created.
Example:
class Student:
def init(self, name):
self.name = name
s1 = Student("Rahul")
βββββββββββββββββββ
πΉ str Method
Used to define what gets printed when we print an object.
Example:
class Student:
def init(self, name):
self.name = name
def str(self):
return f"Student Name: {self.name}"
s1 = Student("Amit")
print(s1)
Without str β It prints object memory address
With str β Custom readable output β
βββββββββββββββββββ
πΉ len Method
Defines behavior for len() function.
Example:
class MyList:
def init(self, items):
self.items = items
def len(self):
return len(self.items)
obj = MyList([1,2,3,4])
print(len(obj))
βββββββββββββββββββ
πΉ Operator Overloading using Magic Methods
Example: add
class Number:
def init(self, value):
self.value = value
def add(self, other):
return self.value + other.value
n1 = Number(5)
n2 = Number(10)
print(n1 + n2)
Now + works for custom objects π₯
βββββββββββββββββββ
πΉ Common Magic Methods
β init β Constructor
β str β String representation
β len β Length
β add β Addition
β sub β Subtraction
β mul β Multiplication
β eq β Equality
βββββββββββββββββββ
π Practice Tasks β Day 32
β Create class Book
β Implement str
β Overload + operator
β Try implementing len
βββββββββββββββββββ
π― Day 32 Goal
β Understand dunder methods
β Customize built-in operations
β Practice operator overloading
βββββββββββββββββββ
π Next Topic β Day 33
π₯ Exception Handling in Python
β¨ Stay Connected | Keep Coding
π TechByWebCoder
β¨ Topic: OOP β Special (Magic / Dunder) Methods
βββββββββββββββββββ
π What are Magic (Dunder) Methods?
Magic methods are special methods that start and end with double underscores:
Example:
init
str
len
They allow us to define behavior for built-in operations.
βDunderβ = Double Under ( __ )
βββββββββββββββββββ
πΉ init Method
Constructor method
Automatically called when object is created.
Example:
class Student:
def init(self, name):
self.name = name
s1 = Student("Rahul")
βββββββββββββββββββ
πΉ str Method
Used to define what gets printed when we print an object.
Example:
class Student:
def init(self, name):
self.name = name
def str(self):
return f"Student Name: {self.name}"
s1 = Student("Amit")
print(s1)
Without str β It prints object memory address
With str β Custom readable output β
βββββββββββββββββββ
πΉ len Method
Defines behavior for len() function.
Example:
class MyList:
def init(self, items):
self.items = items
def len(self):
return len(self.items)
obj = MyList([1,2,3,4])
print(len(obj))
βββββββββββββββββββ
πΉ Operator Overloading using Magic Methods
Example: add
class Number:
def init(self, value):
self.value = value
def add(self, other):
return self.value + other.value
n1 = Number(5)
n2 = Number(10)
print(n1 + n2)
Now + works for custom objects π₯
βββββββββββββββββββ
πΉ Common Magic Methods
β init β Constructor
β str β String representation
β len β Length
β add β Addition
β sub β Subtraction
β mul β Multiplication
β eq β Equality
βββββββββββββββββββ
π Practice Tasks β Day 32
β Create class Book
β Implement str
β Overload + operator
β Try implementing len
βββββββββββββββββββ
π― Day 32 Goal
β Understand dunder methods
β Customize built-in operations
β Practice operator overloading
βββββββββββββββββββ
π Next Topic β Day 33
π₯ Exception Handling in Python
β¨ Stay Connected | Keep Coding
π TechByWebCoder
π PYTHON β DAY 33 STUDY MATERIAL
β¨ Topic: Exception Handling in Python
βββββββββββββββββββ
π What is Exception?
An exception is an error that occurs during program execution.
Examples:
β Division by zero
β Invalid input
β File not found
Without handling β Program crashes
With handling β Program continues safely β
βββββββββββββββββββ
πΉ Basic try-except Syntax
try:
risky code
except:
handle error
Example:
try:
num = 10 / 0
except:
print("Error occurred!")
βββββββββββββββββββ
πΉ Handling Specific Exceptions
try:
num = int(input("Enter number: "))
print(10 / num)
except ZeroDivisionError:
print("Cannot divide by zero")
except ValueError:
print("Invalid input")
βββββββββββββββββββ
πΉ Using else Block
Runs if no exception occurs.
try:
num = int(input("Enter number: "))
except ValueError:
print("Invalid input")
else:
print("You entered:", num)
βββββββββββββββββββ
πΉ Using finally Block
Always executes (whether error occurs or not).
try:
print(10 / 2)
except:
print("Error")
finally:
print("Execution completed")
βββββββββββββββββββ
πΉ Raising Custom Exception
We can create our own error using raise.
Example:
age = 15
if age < 18:
raise ValueError("Age must be 18 or above")
βββββββββββββββββββ
πΉ Creating Custom Exception Class
class MyError(Exception):
pass
raise MyError("Custom error occurred")
βββββββββββββββββββ
π§ Why Exception Handling is Important?
β Prevent program crash
β Improve user experience
β Handle unexpected situations
β Make code professional
βββββββββββββββββββ
π Practice Tasks β Day 33
β Handle ZeroDivisionError
β Handle ValueError
β Use finally block
β Create custom exception
βββββββββββββββββββ
π― Day 33 Goal
β Understand try-except
β Handle multiple exceptions
β Create custom errors
βββββββββββββββββββ
π Next Topic β Day 34
π₯ File Handling in Python
β¨ Stay Connected | Keep Coding
π TechByWebCoder
β¨ Topic: Exception Handling in Python
βββββββββββββββββββ
π What is Exception?
An exception is an error that occurs during program execution.
Examples:
β Division by zero
β Invalid input
β File not found
Without handling β Program crashes
With handling β Program continues safely β
βββββββββββββββββββ
πΉ Basic try-except Syntax
try:
risky code
except:
handle error
Example:
try:
num = 10 / 0
except:
print("Error occurred!")
βββββββββββββββββββ
πΉ Handling Specific Exceptions
try:
num = int(input("Enter number: "))
print(10 / num)
except ZeroDivisionError:
print("Cannot divide by zero")
except ValueError:
print("Invalid input")
βββββββββββββββββββ
πΉ Using else Block
Runs if no exception occurs.
try:
num = int(input("Enter number: "))
except ValueError:
print("Invalid input")
else:
print("You entered:", num)
βββββββββββββββββββ
πΉ Using finally Block
Always executes (whether error occurs or not).
try:
print(10 / 2)
except:
print("Error")
finally:
print("Execution completed")
βββββββββββββββββββ
πΉ Raising Custom Exception
We can create our own error using raise.
Example:
age = 15
if age < 18:
raise ValueError("Age must be 18 or above")
βββββββββββββββββββ
πΉ Creating Custom Exception Class
class MyError(Exception):
pass
raise MyError("Custom error occurred")
βββββββββββββββββββ
π§ Why Exception Handling is Important?
β Prevent program crash
β Improve user experience
β Handle unexpected situations
β Make code professional
βββββββββββββββββββ
π Practice Tasks β Day 33
β Handle ZeroDivisionError
β Handle ValueError
β Use finally block
β Create custom exception
βββββββββββββββββββ
π― Day 33 Goal
β Understand try-except
β Handle multiple exceptions
β Create custom errors
βββββββββββββββββββ
π Next Topic β Day 34
π₯ File Handling in Python
β¨ Stay Connected | Keep Coding
π TechByWebCoder
π PYTHON β DAY 34 STUDY MATERIAL
β¨ Topic: File Handling in Python
βββββββββββββββββββ
π What is File Handling?
File handling allows us to create, read, write, and update files.
β Store data permanently
β Read existing data
β Modify data
βββββββββββββββββββ
πΉ Opening a File
Syntax:
file = open("filename.txt", "mode")
Modes:
"r" β Read
"w" β Write (overwrites file)
"a" β Append
"x" β Create new file
"rb" β Read binary
Example:
file = open("demo.txt", "r")
βββββββββββββββββββ
πΉ Reading a File
file = open("demo.txt", "r")
print(file.read())
file.close()
Other read methods:
file.readline()
file.readlines()
βββββββββββββββββββ
πΉ Writing to a File
file = open("demo.txt", "w")
file.write("Hello Python")
file.close()
β "w" mode overwrites existing data.
βββββββββββββββββββ
πΉ Appending to a File
file = open("demo.txt", "a")
file.write("\nNew Line Added")
file.close()
βββββββββββββββββββ
πΉ Using with Statement (Best Practice)
Automatically closes file.
with open("demo.txt", "r") as file:
data = file.read()
print(data)
No need to call close() β
βββββββββββββββββββ
πΉ Checking if File Exists
import os
if os.path.exists("demo.txt"):
print("File exists")
else:
print("File not found")
βββββββββββββββββββ
π§ Why File Handling is Important?
β Store user data
β Save reports
β Manage logs
β Work with databases & APIs
βββββββββββββββββββ
π Practice Tasks β Day 34
β Create a file
β Write your name into file
β Append new line
β Read entire file
β Use with statement
βββββββββββββββββββ
π― Day 34 Goal
β Understand file modes
β Perform read & write operations
β Use with statement
βββββββββββββββββββ
π Next Topic β Day 35
π₯ Working with CSV Files
β¨ Stay Connected | Keep Coding
π TechByWebCoder
β¨ Topic: File Handling in Python
βββββββββββββββββββ
π What is File Handling?
File handling allows us to create, read, write, and update files.
β Store data permanently
β Read existing data
β Modify data
βββββββββββββββββββ
πΉ Opening a File
Syntax:
file = open("filename.txt", "mode")
Modes:
"r" β Read
"w" β Write (overwrites file)
"a" β Append
"x" β Create new file
"rb" β Read binary
Example:
file = open("demo.txt", "r")
βββββββββββββββββββ
πΉ Reading a File
file = open("demo.txt", "r")
print(file.read())
file.close()
Other read methods:
file.readline()
file.readlines()
βββββββββββββββββββ
πΉ Writing to a File
file = open("demo.txt", "w")
file.write("Hello Python")
file.close()
β "w" mode overwrites existing data.
βββββββββββββββββββ
πΉ Appending to a File
file = open("demo.txt", "a")
file.write("\nNew Line Added")
file.close()
βββββββββββββββββββ
πΉ Using with Statement (Best Practice)
Automatically closes file.
with open("demo.txt", "r") as file:
data = file.read()
print(data)
No need to call close() β
βββββββββββββββββββ
πΉ Checking if File Exists
import os
if os.path.exists("demo.txt"):
print("File exists")
else:
print("File not found")
βββββββββββββββββββ
π§ Why File Handling is Important?
β Store user data
β Save reports
β Manage logs
β Work with databases & APIs
βββββββββββββββββββ
π Practice Tasks β Day 34
β Create a file
β Write your name into file
β Append new line
β Read entire file
β Use with statement
βββββββββββββββββββ
π― Day 34 Goal
β Understand file modes
β Perform read & write operations
β Use with statement
βββββββββββββββββββ
π Next Topic β Day 35
π₯ Working with CSV Files
β¨ Stay Connected | Keep Coding
π TechByWebCoder
π PYTHON β DAY 35 STUDY MATERIAL
β¨ Topic: Working with CSV Files in Python
βββββββββββββββββββ
π What is a CSV File?
CSV = Comma Separated Values
Used to store tabular data like:
β Excel data
β Student records
β Sales reports
Example CSV file:
name,age,city
Rahul,22,Pune
Amit,21,Mumbai
βββββββββββββββββββ
πΉ Importing CSV Module
Python provides built-in module:
import csv
βββββββββββββββββββ
πΉ Reading CSV File
import csv
with open("data.csv", "r") as file:
reader = csv.reader(file)
for row in reader:
print(row)
Each row is returned as a list.
βββββββββββββββββββ
πΉ Writing to CSV File
import csv
with open("data.csv", "w", newline="") as file:
writer = csv.writer(file)
writer.writerow(["Name", "Age", "City"])
writer.writerow(["Soham", 20, "Pune"])
βββββββββββββββββββ
πΉ Appending Data to CSV
with open("data.csv", "a", newline="") as file:
writer = csv.writer(file)
writer.writerow(["Amit", 22, "Mumbai"])
βββββββββββββββββββ
πΉ Using DictReader (Advanced Reading)
import csv
with open("data.csv", "r") as file:
reader = csv.DictReader(file)
for row in reader:
print(row["Name"], row["City"])
Reads CSV as dictionary π₯
βββββββββββββββββββ
πΉ Using DictWriter
with open("data.csv", "w", newline="") as file:
fieldnames = ["Name", "Age"]
writer = csv.DictWriter(file, fieldnames=fieldnames)
writer.writeheader()
writer.writerow({"Name": "Rahul", "Age": 22})
βββββββββββββββββββ
π§ Why CSV is Important?
β Used in Data Science
β Used in Excel integration
β Used in reporting systems
β Used in real-world projects
βββββββββββββββββββ
π Practice Tasks β Day 35
β Create student.csv file
β Add 5 student records
β Read and print specific column
β Use DictReader
βββββββββββββββββββ
π― Day 35 Goal
β Understand CSV module
β Perform read & write operations
β Work with structured data
βββββββββββββββββββ
π Next Topic β Day 36
π₯ Working with JSON in Python
β¨ Stay Connected | Keep Coding
π TechByWebCoder
β¨ Topic: Working with CSV Files in Python
βββββββββββββββββββ
π What is a CSV File?
CSV = Comma Separated Values
Used to store tabular data like:
β Excel data
β Student records
β Sales reports
Example CSV file:
name,age,city
Rahul,22,Pune
Amit,21,Mumbai
βββββββββββββββββββ
πΉ Importing CSV Module
Python provides built-in module:
import csv
βββββββββββββββββββ
πΉ Reading CSV File
import csv
with open("data.csv", "r") as file:
reader = csv.reader(file)
for row in reader:
print(row)
Each row is returned as a list.
βββββββββββββββββββ
πΉ Writing to CSV File
import csv
with open("data.csv", "w", newline="") as file:
writer = csv.writer(file)
writer.writerow(["Name", "Age", "City"])
writer.writerow(["Soham", 20, "Pune"])
βββββββββββββββββββ
πΉ Appending Data to CSV
with open("data.csv", "a", newline="") as file:
writer = csv.writer(file)
writer.writerow(["Amit", 22, "Mumbai"])
βββββββββββββββββββ
πΉ Using DictReader (Advanced Reading)
import csv
with open("data.csv", "r") as file:
reader = csv.DictReader(file)
for row in reader:
print(row["Name"], row["City"])
Reads CSV as dictionary π₯
βββββββββββββββββββ
πΉ Using DictWriter
with open("data.csv", "w", newline="") as file:
fieldnames = ["Name", "Age"]
writer = csv.DictWriter(file, fieldnames=fieldnames)
writer.writeheader()
writer.writerow({"Name": "Rahul", "Age": 22})
βββββββββββββββββββ
π§ Why CSV is Important?
β Used in Data Science
β Used in Excel integration
β Used in reporting systems
β Used in real-world projects
βββββββββββββββββββ
π Practice Tasks β Day 35
β Create student.csv file
β Add 5 student records
β Read and print specific column
β Use DictReader
βββββββββββββββββββ
π― Day 35 Goal
β Understand CSV module
β Perform read & write operations
β Work with structured data
βββββββββββββββββββ
π Next Topic β Day 36
π₯ Working with JSON in Python
β¨ Stay Connected | Keep Coding
π TechByWebCoder
π PYTHON β DAY 36 STUDY MATERIAL
β¨ Topic: Working with JSON in Python
βββββββββββββββββββ
π What is JSON?
JSON = JavaScript Object Notation
β Lightweight data format
β Used in APIs
β Used in Web & Mobile Apps
β Human readable
Example JSON:
{ "name": "Soham", "age": 20, "city": "Pune" }
βββββββββββββββββββ
πΉ Import JSON Module
Python provides built-in module:
import json
βββββββββββββββββββ
πΉ Convert Python β JSON (Serialization)
import json
data = { "name": "Rahul", "age": 22 }
json_data = json.dumps(data)
print(json_data)
dumps() β Convert dictionary to JSON string
βββββββββββββββββββ
πΉ Convert JSON β Python (Deserialization)
import json
json_string = '{"name": "Amit", "age": 21}'
data = json.loads(json_string)
print(data["name"])
loads() β Convert JSON string to dictionary
βββββββββββββββββββ
πΉ Writing JSON to File
import json
data = {"name": "Soham", "age": 20}
with open("data.json", "w") as file:
json.dump(data, file)
dump() β Write JSON to file
βββββββββββββββββββ
πΉ Reading JSON from File
import json
with open("data.json", "r") as file:
data = json.load(file)
print(data)
load() β Read JSON from file
βββββββββββββββββββ
πΉ Pretty Printing JSON
print(json.dumps(data, indent=4))
indent β Makes JSON readable
βββββββββββββββββββ
π§ Why JSON is Important?
β Used in REST APIs
β Used in Web Development
β Used in Data Exchange
β Used in Backend Systems
βββββββββββββββββββ
π Practice Tasks β Day 36
β Create dictionary
β Convert to JSON
β Save in file
β Read from file
β Pretty print output
βββββββββββββββββββ
π― Day 36 Goal
β Understand serialization & deserialization
β Work with JSON files
β Prepare for API integration
βββββββββββββββββββ
π Next Topic β Day 37
π₯ Modules & Packages in Python
β¨ Stay Connected | Keep Coding
π TechByWebCoder
β¨ Topic: Working with JSON in Python
βββββββββββββββββββ
π What is JSON?
JSON = JavaScript Object Notation
β Lightweight data format
β Used in APIs
β Used in Web & Mobile Apps
β Human readable
Example JSON:
{ "name": "Soham", "age": 20, "city": "Pune" }
βββββββββββββββββββ
πΉ Import JSON Module
Python provides built-in module:
import json
βββββββββββββββββββ
πΉ Convert Python β JSON (Serialization)
import json
data = { "name": "Rahul", "age": 22 }
json_data = json.dumps(data)
print(json_data)
dumps() β Convert dictionary to JSON string
βββββββββββββββββββ
πΉ Convert JSON β Python (Deserialization)
import json
json_string = '{"name": "Amit", "age": 21}'
data = json.loads(json_string)
print(data["name"])
loads() β Convert JSON string to dictionary
βββββββββββββββββββ
πΉ Writing JSON to File
import json
data = {"name": "Soham", "age": 20}
with open("data.json", "w") as file:
json.dump(data, file)
dump() β Write JSON to file
βββββββββββββββββββ
πΉ Reading JSON from File
import json
with open("data.json", "r") as file:
data = json.load(file)
print(data)
load() β Read JSON from file
βββββββββββββββββββ
πΉ Pretty Printing JSON
print(json.dumps(data, indent=4))
indent β Makes JSON readable
βββββββββββββββββββ
π§ Why JSON is Important?
β Used in REST APIs
β Used in Web Development
β Used in Data Exchange
β Used in Backend Systems
βββββββββββββββββββ
π Practice Tasks β Day 36
β Create dictionary
β Convert to JSON
β Save in file
β Read from file
β Pretty print output
βββββββββββββββββββ
π― Day 36 Goal
β Understand serialization & deserialization
β Work with JSON files
β Prepare for API integration
βββββββββββββββββββ
π Next Topic β Day 37
π₯ Modules & Packages in Python
β¨ Stay Connected | Keep Coding
π TechByWebCoder
π PYTHON β DAY 37 STUDY MATERIAL
β¨ Topic: Modules & Packages in Python
βββββββββββββββββββ
π What is a Module?
A module is a Python file (.py) containing functions, variables, or classes.
β Helps organize code
β Enables code reuse
β Improves readability
Example:
math.py β custom module
βββββββββββββββββββ
πΉ Using Built-in Modules
Python provides many built-in modules:
β math
β random
β datetime
β os
β sys
Example:
import math
print(math.sqrt(16))
print(math.pi)
βββββββββββββββββββ
πΉ Importing Specific Function
from math import sqrt
print(sqrt(25))
βββββββββββββββββββ
πΉ Import with Alias
import math as m
print(m.pi)
βββββββββββββββββββ
πΉ Creating Your Own Module
Step 1: Create file mymodule.py
def greet(name):
print("Hello", name)
Step 2: Use it in another file
import mymodule
mymodule.greet("Soham")
βββββββββββββββββββ
π¦ What is a Package?
A package is a folder containing multiple modules.
It must contain a special file:
init.py
Example structure:
mypackage/
βββ init.py
βββ module1.py
βββ module2.py
Import example:
from mypackage import module1
βββββββββββββββββββ
πΉ Using name Variable
Every Python file has a special variable:
print(name)
If file is run directly β main
If imported β module name
Example:
if name == "main":
print("Run directly")
βββββββββββββββββββ
π§ Why Modules & Packages?
β Large project management
β Code reusability
β Professional coding practice
β Used in real-world applications
βββββββββββββββββββ
π Practice Tasks β Day 37
β Use math module
β Create custom module
β Import with alias
β Create simple package
βββββββββββββββββββ
π― Day 37 Goal
β Understand modular programming
β Create and use custom modules
β Understand package structure
βββββββββββββββββββ
π Next Topic β Day 38
π₯ Virtual Environment & pip
β¨ Stay Connected | Keep Coding
π TechByWebCoder
β¨ Topic: Modules & Packages in Python
βββββββββββββββββββ
π What is a Module?
A module is a Python file (.py) containing functions, variables, or classes.
β Helps organize code
β Enables code reuse
β Improves readability
Example:
math.py β custom module
βββββββββββββββββββ
πΉ Using Built-in Modules
Python provides many built-in modules:
β math
β random
β datetime
β os
β sys
Example:
import math
print(math.sqrt(16))
print(math.pi)
βββββββββββββββββββ
πΉ Importing Specific Function
from math import sqrt
print(sqrt(25))
βββββββββββββββββββ
πΉ Import with Alias
import math as m
print(m.pi)
βββββββββββββββββββ
πΉ Creating Your Own Module
Step 1: Create file mymodule.py
def greet(name):
print("Hello", name)
Step 2: Use it in another file
import mymodule
mymodule.greet("Soham")
βββββββββββββββββββ
π¦ What is a Package?
A package is a folder containing multiple modules.
It must contain a special file:
init.py
Example structure:
mypackage/
βββ init.py
βββ module1.py
βββ module2.py
Import example:
from mypackage import module1
βββββββββββββββββββ
πΉ Using name Variable
Every Python file has a special variable:
print(name)
If file is run directly β main
If imported β module name
Example:
if name == "main":
print("Run directly")
βββββββββββββββββββ
π§ Why Modules & Packages?
β Large project management
β Code reusability
β Professional coding practice
β Used in real-world applications
βββββββββββββββββββ
π Practice Tasks β Day 37
β Use math module
β Create custom module
β Import with alias
β Create simple package
βββββββββββββββββββ
π― Day 37 Goal
β Understand modular programming
β Create and use custom modules
β Understand package structure
βββββββββββββββββββ
π Next Topic β Day 38
π₯ Virtual Environment & pip
β¨ Stay Connected | Keep Coding
π TechByWebCoder
π PYTHON β DAY 38 STUDY MATERIAL
β¨ Topic: Virtual Environment & pip
βββββββββββββββββββ
π What is pip?
pip is Pythonβs package manager.
It is used to:
β Install packages
β Upgrade packages
β Remove packages
β Manage project dependencies
Check pip version:
pip --version
βββββββββββββββββββ
πΉ Installing a Package
Example:
pip install requests
Install specific version:
pip install requests==2.31.0
βββββββββββββββββββ
πΉ Upgrading a Package
pip install --upgrade requests
βββββββββββββββββββ
πΉ Uninstalling a Package
pip uninstall requests
βββββββββββββββββββ
π¦ What is Virtual Environment?
A virtual environment creates an isolated Python environment for each project.
Why important?
β Avoid version conflicts
β Separate project dependencies
β Professional development practice
βββββββββββββββββββ
πΉ Creating Virtual Environment
Step 1:
python -m venv myenv
Step 2: Activate it
Windows:
myenv\Scripts\activate
Mac/Linux:
source myenv/bin/activate
After activation β (myenv) will appear in terminal β
βββββββββββββββββββ
πΉ Deactivating Virtual Environment
deactivate
βββββββββββββββββββ
πΉ requirements.txt File
Used to store project dependencies.
Create file:
pip freeze > requirements.txt
Install from file:
pip install -r requirements.txt
βββββββββββββββββββ
π§ Why This is Important?
β Used in real-world projects
β Required in Django/Flask
β Required for deployment
β Used in teamwork
βββββββββββββββββββ
π Practice Tasks β Day 38
β Create virtual environment
β Install any package
β Freeze requirements
β Deactivate environment
βββββββββββββββββββ
π― Day 38 Goal
β Understand pip
β Create virtual environment
β Manage dependencies professionally
βββββββββββββββββββ
π Next Topic β Day 39
π₯ Introduction to Web Requests & APIs
β¨ Stay Connected | Keep Coding
π TechByWebCoder
β¨ Topic: Virtual Environment & pip
βββββββββββββββββββ
π What is pip?
pip is Pythonβs package manager.
It is used to:
β Install packages
β Upgrade packages
β Remove packages
β Manage project dependencies
Check pip version:
pip --version
βββββββββββββββββββ
πΉ Installing a Package
Example:
pip install requests
Install specific version:
pip install requests==2.31.0
βββββββββββββββββββ
πΉ Upgrading a Package
pip install --upgrade requests
βββββββββββββββββββ
πΉ Uninstalling a Package
pip uninstall requests
βββββββββββββββββββ
π¦ What is Virtual Environment?
A virtual environment creates an isolated Python environment for each project.
Why important?
β Avoid version conflicts
β Separate project dependencies
β Professional development practice
βββββββββββββββββββ
πΉ Creating Virtual Environment
Step 1:
python -m venv myenv
Step 2: Activate it
Windows:
myenv\Scripts\activate
Mac/Linux:
source myenv/bin/activate
After activation β (myenv) will appear in terminal β
βββββββββββββββββββ
πΉ Deactivating Virtual Environment
deactivate
βββββββββββββββββββ
πΉ requirements.txt File
Used to store project dependencies.
Create file:
pip freeze > requirements.txt
Install from file:
pip install -r requirements.txt
βββββββββββββββββββ
π§ Why This is Important?
β Used in real-world projects
β Required in Django/Flask
β Required for deployment
β Used in teamwork
βββββββββββββββββββ
π Practice Tasks β Day 38
β Create virtual environment
β Install any package
β Freeze requirements
β Deactivate environment
βββββββββββββββββββ
π― Day 38 Goal
β Understand pip
β Create virtual environment
β Manage dependencies professionally
βββββββββββββββββββ
π Next Topic β Day 39
π₯ Introduction to Web Requests & APIs
β¨ Stay Connected | Keep Coding
π TechByWebCoder
π PYTHON β DAY 39 STUDY MATERIAL
β¨ Topic: Introduction to Web Requests & APIs
βββββββββββββββββββ
π What is an API?
API = Application Programming Interface
It allows applications to communicate with each other.
Example:
β Weather App β Gets data from weather
API
β Payment App β Connects to bank server
β Instagram β Connects to backend server
βββββββββββββββββββ
π What is HTTP Request?
When your program communicates with a server, it sends:
β GET β Fetch data
β POST β Send data
β PUT β Update data
β DELETE β Remove data
βββββββββββββββββββ
π¦ Using requests Library
First install:
pip install requests
Then import:
import requests
βββββββββββββββββββ
πΉ Making a GET Request
import requests
response = requests.get("https://api.github.comοΏ½")
print(response.status_code)
print(response.text)
βββββββββββββββββββ
πΉ Getting JSON Response
import requests
response = requests.get("https://api.github.comοΏ½")
data = response.json()
print(data)
.json() converts response into dictionary π₯
βββββββββββββββββββ
πΉ Making a POST Request
import requests
data = {"name": "Soham"}
response = requests.post("https://httpbin.org/postοΏ½", json=data)
print(response.json())
βββββββββββββββββββ
πΉ Checking Response Status
200 β Success β
404 β Not Found β
500 β Server Error β
Example:
if response.status_code == 200:
print("Request successful")
βββββββββββββββββββ
π§ Why APIs Are Important?
β Used in Web Development
β Used in Mobile Apps
β Used in Automation
β Used in Data Science
βββββββββββββββββββ
π Practice Tasks β Day 39
β Install requests
β Make GET request
β Print JSON response
β Check status code
β Try POST request
βββββββββββββββββββ
π― Day 39 Goal
β Understand API concept
β Make HTTP requests
β Work with JSON responses aa
βββββββββββββββββββ
π Next Topic β Day 40
π₯ Mini Project β Weather App using API
β¨ Stay Connected | Keep Coding
π TechByWebCoder
β¨ Topic: Introduction to Web Requests & APIs
βββββββββββββββββββ
π What is an API?
API = Application Programming Interface
It allows applications to communicate with each other.
Example:
β Weather App β Gets data from weather
API
β Payment App β Connects to bank server
β Instagram β Connects to backend server
βββββββββββββββββββ
π What is HTTP Request?
When your program communicates with a server, it sends:
β GET β Fetch data
β POST β Send data
β PUT β Update data
β DELETE β Remove data
βββββββββββββββββββ
π¦ Using requests Library
First install:
pip install requests
Then import:
import requests
βββββββββββββββββββ
πΉ Making a GET Request
import requests
response = requests.get("https://api.github.comοΏ½")
print(response.status_code)
print(response.text)
βββββββββββββββββββ
πΉ Getting JSON Response
import requests
response = requests.get("https://api.github.comοΏ½")
data = response.json()
print(data)
.json() converts response into dictionary π₯
βββββββββββββββββββ
πΉ Making a POST Request
import requests
data = {"name": "Soham"}
response = requests.post("https://httpbin.org/postοΏ½", json=data)
print(response.json())
βββββββββββββββββββ
πΉ Checking Response Status
200 β Success β
404 β Not Found β
500 β Server Error β
Example:
if response.status_code == 200:
print("Request successful")
βββββββββββββββββββ
π§ Why APIs Are Important?
β Used in Web Development
β Used in Mobile Apps
β Used in Automation
β Used in Data Science
βββββββββββββββββββ
π Practice Tasks β Day 39
β Install requests
β Make GET request
β Print JSON response
β Check status code
β Try POST request
βββββββββββββββββββ
π― Day 39 Goal
β Understand API concept
β Make HTTP requests
β Work with JSON responses aa
βββββββββββββββββββ
π Next Topic β Day 40
π₯ Mini Project β Weather App using API
β¨ Stay Connected | Keep Coding
π TechByWebCoder
π PYTHON β DAY 40 STUDY MATERIAL
β¨ Mini Project: Weather App using API
βββββββββββββββββββ
π Project Goal
Create a simple Weather App that:
β Takes city name as input
β Fetches weather data from API
β Displays temperature & condition
Real-world concept:
API Integration + JSON Handling + User Input
βββββββββββββββββββ
π Step 1: Install Required Library
pip install requests
βββββββββββββββββββ
π Step 2: Get API Key
You can use free weather API like:
https://openweathermap.orgβ οΏ½
(Create free account β Generate API key)
βββββββββββββββββββ
π§ Step 3: Basic Weather App Code
import requests
api_key = "YOUR_API_KEY"
city = input("Enter city name: ")
url = f"http://api.openweathermap.org/data/2.5/weather?q={city}&appid={api_key}&units=metric"
response = requests.get(url)
data = response.json()
if response.status_code == 200:
temp = data["main"]["temp"]
desc = data["weather"][0]["description"]
print("City:", city)
print("Temperature:", temp, "Β°C")
print("Condition:", desc)
else:
print("City not found β")
βββββββββββββββββββ
π How It Works?
β User enters city
β API sends request
β Server returns JSON
β Python extracts temperature & description
βββββββββββββββββββ
π Error Handling Improvement
Add try-except:
try:
response = requests.get(url)
data = response.json()
except Exception as e:
print("Error:", e)
βββββββββββββββββββ
π¨ Bonus Improvements
β Add emoji based on weather βπ§β
β Use formatted output
β Add loop for multiple searches
β Add GUI using Tkinter
βββββββββββββββββββ
π Practice Tasks β Day 40
β Create weather app
β Handle invalid city
β Add loop option
β Improve output formatting
βββββββββββββββββββ
π― Day 40 Goal
β Integrate API
β Handle JSON
β Build mini project
βββββββββββββββββββ
π Next Topic β Day 41
π₯ Introduction to Tkinter (GUI Programming)
β¨ Stay Connected | Keep Coding
π TechByWebCoder
β¨ Mini Project: Weather App using API
βββββββββββββββββββ
π Project Goal
Create a simple Weather App that:
β Takes city name as input
β Fetches weather data from API
β Displays temperature & condition
Real-world concept:
API Integration + JSON Handling + User Input
βββββββββββββββββββ
π Step 1: Install Required Library
pip install requests
βββββββββββββββββββ
π Step 2: Get API Key
You can use free weather API like:
https://openweathermap.orgβ οΏ½
(Create free account β Generate API key)
βββββββββββββββββββ
π§ Step 3: Basic Weather App Code
import requests
api_key = "YOUR_API_KEY"
city = input("Enter city name: ")
url = f"http://api.openweathermap.org/data/2.5/weather?q={city}&appid={api_key}&units=metric"
response = requests.get(url)
data = response.json()
if response.status_code == 200:
temp = data["main"]["temp"]
desc = data["weather"][0]["description"]
print("City:", city)
print("Temperature:", temp, "Β°C")
print("Condition:", desc)
else:
print("City not found β")
βββββββββββββββββββ
π How It Works?
β User enters city
β API sends request
β Server returns JSON
β Python extracts temperature & description
βββββββββββββββββββ
π Error Handling Improvement
Add try-except:
try:
response = requests.get(url)
data = response.json()
except Exception as e:
print("Error:", e)
βββββββββββββββββββ
π¨ Bonus Improvements
β Add emoji based on weather βπ§β
β Use formatted output
β Add loop for multiple searches
β Add GUI using Tkinter
βββββββββββββββββββ
π Practice Tasks β Day 40
β Create weather app
β Handle invalid city
β Add loop option
β Improve output formatting
βββββββββββββββββββ
π― Day 40 Goal
β Integrate API
β Handle JSON
β Build mini project
βββββββββββββββββββ
π Next Topic β Day 41
π₯ Introduction to Tkinter (GUI Programming)
β¨ Stay Connected | Keep Coding
π TechByWebCoder
π PYTHON β DAY 41 STUDY MATERIAL
β¨ Topic: Introduction to Tkinter (GUI Programming)
βββββββββββββββββββ
π What is Tkinter?
Tkinter is Pythonβs built-in GUI (Graphical User Interface) library.
It allows you to create:
β Desktop Applications
β Forms
β Buttons & Labels
β Mini Software Projects
No installation required β (Built-in with Python)
βββββββββββββββββββ
π₯οΈ Creating First GUI Window
import tkinter as tk
root = tk.Tk()
root.title("My First App")
root.geometry("400x300")
root.mainloop()
This creates a simple window π₯
βββββββββββββββββββ
πΉ Adding a Label
import tkinter as tk
root = tk.Tk()
label = tk.Label(root, text="Hello Python GUI")
label.pack()
root.mainloop()
βββββββββββββββββββ
πΉ Adding a Button
import tkinter as tk
def click():
print("Button Clicked!")
root = tk.Tk()
btn = tk.Button(root, text="Click Me", command=click)
btn.pack()
root.mainloop()
βββββββββββββββββββ
πΉ Adding Entry (Input Box)
import tkinter as tk
def show():
print(entry.get())
root = tk.Tk()
entry = tk.Entry(root)
entry.pack()
btn = tk.Button(root, text="Submit", command=show)
btn.pack()
root.mainloop()
βββββββββββββββββββ
π Layout Methods
β pack() β Simple layout
β grid() β Table layout
β place() β Custom position
Example (grid):
label.grid(row=0, column=0)
βββββββββββββββββββ
π§ Why Tkinter?
β Build Desktop Apps
β Create Login Forms
β Build Calculator
β Create Management Systems
βββββββββββββββββββ
π Practice Tasks β Day 41
β Create window
β Add label
β Add button
β Take user input
β Try grid layout
βββββββββββββββββββ
π― Day 41 Goal
β Create basic GUI
β Add widgets
β Understand event handling
ββββββββββββββββββ
π Next Topic β Day 42
π₯ Building Calculator using Tkinter
β¨ Stay Connected | Keep Coding
π TechByWebCoder
β¨ Topic: Introduction to Tkinter (GUI Programming)
βββββββββββββββββββ
π What is Tkinter?
Tkinter is Pythonβs built-in GUI (Graphical User Interface) library.
It allows you to create:
β Desktop Applications
β Forms
β Buttons & Labels
β Mini Software Projects
No installation required β (Built-in with Python)
βββββββββββββββββββ
π₯οΈ Creating First GUI Window
import tkinter as tk
root = tk.Tk()
root.title("My First App")
root.geometry("400x300")
root.mainloop()
This creates a simple window π₯
βββββββββββββββββββ
πΉ Adding a Label
import tkinter as tk
root = tk.Tk()
label = tk.Label(root, text="Hello Python GUI")
label.pack()
root.mainloop()
βββββββββββββββββββ
πΉ Adding a Button
import tkinter as tk
def click():
print("Button Clicked!")
root = tk.Tk()
btn = tk.Button(root, text="Click Me", command=click)
btn.pack()
root.mainloop()
βββββββββββββββββββ
πΉ Adding Entry (Input Box)
import tkinter as tk
def show():
print(entry.get())
root = tk.Tk()
entry = tk.Entry(root)
entry.pack()
btn = tk.Button(root, text="Submit", command=show)
btn.pack()
root.mainloop()
βββββββββββββββββββ
π Layout Methods
β pack() β Simple layout
β grid() β Table layout
β place() β Custom position
Example (grid):
label.grid(row=0, column=0)
βββββββββββββββββββ
π§ Why Tkinter?
β Build Desktop Apps
β Create Login Forms
β Build Calculator
β Create Management Systems
βββββββββββββββββββ
π Practice Tasks β Day 41
β Create window
β Add label
β Add button
β Take user input
β Try grid layout
βββββββββββββββββββ
π― Day 41 Goal
β Create basic GUI
β Add widgets
β Understand event handling
ββββββββββββββββββ
π Next Topic β Day 42
π₯ Building Calculator using Tkinter
β¨ Stay Connected | Keep Coding
π TechByWebCoder
π PYTHON β DAY 42 STUDY MATERIAL
β¨ Mini Project: Calculator using Tkinter
βββββββββββββββββββ
π Project Goal
Create a simple calculator that:
β Takes two numbers
β Performs addition, subtraction, multiplication, division
β Displays result on screen
Concepts Used:
β Tkinter GUI
β Functions
β Event Handling
βββββββββββββββββββ
π₯οΈ Basic Calculator Code
import tkinter as tk
def calculate(operation):
num1 = float(entry1.get())
num2 = float(entry2.get())
if operation == "+":
result = num1 + num2
elif operation == "-":
result = num1 - num2
elif operation == "*":
result = num1 * num2
elif operation == "/":
result = num1 / num2
result_label.config(text="Result: " + str(result))
root = tk.Tk()
root.title("Calculator")
root.geometry("300x250")
tk.Label(root, text="Enter First Number").pack()
entry1 = tk.Entry(root)
entry1.pack()
tk.Label(root, text="Enter Second Number").pack()
entry2 = tk.Entry(root)
entry2.pack()
tk.Button(root, text="Add", command=lambda: calculate("+")).pack()
tk.Button(root, text="Subtract", command=lambda: calculate("-")).pack()
tk.Button(root, text="Multiply", command=lambda: calculate("*")).pack()
tk.Button(root, text="Divide", command=lambda: calculate("/")).pack()
result_label = tk.Label(root, text="Result: ")
result_label.pack()
root.mainloop()
βββββββββββββββββββ
β Improvement: Add Error Handling
Add try-except inside calculate():
try:
num1 = float(entry1.get())
num2 = float(entry2.get())
except ValueError:
result_label.config(text="Invalid Input β")
βββββββββββββββββββ
π¨ Bonus Improvements
β Add clear button
β Use grid layout
β Add better UI design
β Add keyboard support
ββββββββββββββββββ
π Practice Tasks β Day 42
β Build calculator
β Add error handling
β Improve UI
β Add clear button
βββββββββββββββββββ
π― Day 42 Goal
β Build complete GUI project
β Use functions with buttons
β Handle user input errors
βββββββββββββββββββ
π Next Topic β Day 43
π₯ Introduction to SQLite Database in Python
β¨ Stay Connected | Keep Coding
π TechByWebCoder
β¨ Mini Project: Calculator using Tkinter
βββββββββββββββββββ
π Project Goal
Create a simple calculator that:
β Takes two numbers
β Performs addition, subtraction, multiplication, division
β Displays result on screen
Concepts Used:
β Tkinter GUI
β Functions
β Event Handling
βββββββββββββββββββ
π₯οΈ Basic Calculator Code
import tkinter as tk
def calculate(operation):
num1 = float(entry1.get())
num2 = float(entry2.get())
if operation == "+":
result = num1 + num2
elif operation == "-":
result = num1 - num2
elif operation == "*":
result = num1 * num2
elif operation == "/":
result = num1 / num2
result_label.config(text="Result: " + str(result))
root = tk.Tk()
root.title("Calculator")
root.geometry("300x250")
tk.Label(root, text="Enter First Number").pack()
entry1 = tk.Entry(root)
entry1.pack()
tk.Label(root, text="Enter Second Number").pack()
entry2 = tk.Entry(root)
entry2.pack()
tk.Button(root, text="Add", command=lambda: calculate("+")).pack()
tk.Button(root, text="Subtract", command=lambda: calculate("-")).pack()
tk.Button(root, text="Multiply", command=lambda: calculate("*")).pack()
tk.Button(root, text="Divide", command=lambda: calculate("/")).pack()
result_label = tk.Label(root, text="Result: ")
result_label.pack()
root.mainloop()
βββββββββββββββββββ
β Improvement: Add Error Handling
Add try-except inside calculate():
try:
num1 = float(entry1.get())
num2 = float(entry2.get())
except ValueError:
result_label.config(text="Invalid Input β")
βββββββββββββββββββ
π¨ Bonus Improvements
β Add clear button
β Use grid layout
β Add better UI design
β Add keyboard support
ββββββββββββββββββ
π Practice Tasks β Day 42
β Build calculator
β Add error handling
β Improve UI
β Add clear button
βββββββββββββββββββ
π― Day 42 Goal
β Build complete GUI project
β Use functions with buttons
β Handle user input errors
βββββββββββββββββββ
π Next Topic β Day 43
π₯ Introduction to SQLite Database in Python
β¨ Stay Connected | Keep Coding
π TechByWebCoder
π PYTHON β DAY 43 STUDY MATERIAL
β¨ Topic: Introduction to SQLite Database in Python
βββββββββββββββββββ
π What is SQLite?
SQLite is a lightweight database that is stored in a single file.
β No server required
β Built into Python
β Perfect for small applications
Used in:
π± Mobile apps
π» Desktop apps
π§ Prototyping databases
βββββββββββββββββββ
πΉ Import SQLite Module
SQLite comes built-in with Python.
import sqlite3
βββββββββββββββββββ
πΉ Creating a Database
import sqlite3
conn = sqlite3.connect("student.db")
print("Database created successfully")
This creates a file student.db
βββββββββββββββββββ
πΉ Creating a Table
import sqlite3
conn = sqlite3.connect("student.db")
cursor = conn.cursor()
cursor.execute(""" CREATE TABLE student( id INTEGER PRIMARY KEY, name TEXT, age INTEGER ) """)
conn.commit()
conn.close()
βββββββββββββββββββ
πΉ Inserting Data
import sqlite3
conn = sqlite3.connect("student.db")
cursor = conn.cursor()
cursor.execute("INSERT INTO student VALUES(1,'Soham',20)")
conn.commit()
conn.close()
βββββββββββββββββββ
πΉ Reading Data
conn = sqlite3.connect("student.db")
cursor = conn.cursor()
cursor.execute("SELECT * FROM student")
rows = cursor.fetchall()
for row in rows:
print(row)
βββββββββββββββββββ
πΉ Updating Data
cursor.execute( "UPDATE student SET age=21 WHERE id=1"
βββββββββββββββββββ
πΉ Deleting Data
cursor.execute( "DELETE FROM student WHERE id=1" )
βββββββββββββββββββ
π§ Why SQLite is Useful?
β Build small database applications
β Store app data locally
β Practice SQL with Python
βββββββββββββββββββ
π Practice Tasks β Day 43
β Create database file
β Create student table
β Insert 3 records
β Display all records
β Update a record
βββββββββββββββββββ
π― Day 43 Goal
β Connect Python with database
β Perform CRUD operations
β Understand cursor & commit
βββββββββββββββββββ
π Next Topic β Day 44
π₯ Building Student Management System with SQLite
β¨ Stay Connected | Keep Coding
π TechByWebCoder
β¨ Topic: Introduction to SQLite Database in Python
βββββββββββββββββββ
π What is SQLite?
SQLite is a lightweight database that is stored in a single file.
β No server required
β Built into Python
β Perfect for small applications
Used in:
π± Mobile apps
π» Desktop apps
π§ Prototyping databases
βββββββββββββββββββ
πΉ Import SQLite Module
SQLite comes built-in with Python.
import sqlite3
βββββββββββββββββββ
πΉ Creating a Database
import sqlite3
conn = sqlite3.connect("student.db")
print("Database created successfully")
This creates a file student.db
βββββββββββββββββββ
πΉ Creating a Table
import sqlite3
conn = sqlite3.connect("student.db")
cursor = conn.cursor()
cursor.execute(""" CREATE TABLE student( id INTEGER PRIMARY KEY, name TEXT, age INTEGER ) """)
conn.commit()
conn.close()
βββββββββββββββββββ
πΉ Inserting Data
import sqlite3
conn = sqlite3.connect("student.db")
cursor = conn.cursor()
cursor.execute("INSERT INTO student VALUES(1,'Soham',20)")
conn.commit()
conn.close()
βββββββββββββββββββ
πΉ Reading Data
conn = sqlite3.connect("student.db")
cursor = conn.cursor()
cursor.execute("SELECT * FROM student")
rows = cursor.fetchall()
for row in rows:
print(row)
βββββββββββββββββββ
πΉ Updating Data
cursor.execute( "UPDATE student SET age=21 WHERE id=1"
βββββββββββββββββββ
πΉ Deleting Data
cursor.execute( "DELETE FROM student WHERE id=1" )
βββββββββββββββββββ
π§ Why SQLite is Useful?
β Build small database applications
β Store app data locally
β Practice SQL with Python
βββββββββββββββββββ
π Practice Tasks β Day 43
β Create database file
β Create student table
β Insert 3 records
β Display all records
β Update a record
βββββββββββββββββββ
π― Day 43 Goal
β Connect Python with database
β Perform CRUD operations
β Understand cursor & commit
βββββββββββββββββββ
π Next Topic β Day 44
π₯ Building Student Management System with SQLite
β¨ Stay Connected | Keep Coding
π TechByWebCoder
π PYTHON β DAY 44 STUDY MATERIAL
β¨ Mini Project: Student Management System using SQLite
βββββββββββββββββββ
π Project Goal
Create a simple Student Management System that can:
β Add student record
β View student records
β Update student details
β Delete student record
Concepts Used:
β SQLite Database
β CRUD Operations
β Python Functions
βββββββββββββββββββ
π Step 1: Create Database & Table
import sqlite3
conn = sqlite3.connect("student.db")
cursor = conn.cursor()
cursor.execute(""" CREATE TABLE IF NOT EXISTS student( id INTEGER PRIMARY KEY, name TEXT, age INTEGER, course TEXT ) """)
conn.commit()
βββββββββββββββββββ
β Step 2: Insert Student Data
def add_student(id, name, age, course):
cursor.execute( "INSERT INTO student VALUES(?,?,?,?)", (id, name, age, course) )
conn.commit()
Example:
add_student(1,"Soham",20,"Python")
βββββββββββββββββββ
π Step 3: View Students
def view_students():
cursor.execute("SELECT * FROM student")
rows = cursor.fetchall()
for row in rows:
print(row)
βββββββββββββββββββ
β Step 4: Update Student
def update_student(id, age):
cursor.execute( "UPDATE student SET age=? WHERE id=?", (age,id) )
conn.commit()
βββββββββββββββββββ
β Step 5: Delete Student
def delete_student(id):
cursor.execute( "DELETE FROM student WHERE id=?", (id,) )
conn.commit()
βββββββββββββββββββ
π§ How the System Works?
1οΈβ£ User adds student
2οΈβ£ Data stored in database
3οΈβ£ User can view/update/delete records
Real-world concept:
β Database CRUD operations
βββββββββββββββββββ
π¨ Bonus Improvements
β Add menu system
β Add input validation
β Connect with Tkinter GUI
β Export data to CSV
βββββββββββββββββββ
π Practice Tasks β Day 44
β Create student database
β Insert 5 students
β Display all records
β Update one record
β Delete one record
βββββββββββββββββββ
π― Day 44 Goal
β Build database project
β Understand CRUD operations
β Use SQLite with Python
βββββββββββββββββββ
π Next Topic β Day 45
π₯ Web Scraping using Python (BeautifulSoup)
β¨ Stay Connected | Keep Coding
π TechByWebCoder
β¨ Mini Project: Student Management System using SQLite
βββββββββββββββββββ
π Project Goal
Create a simple Student Management System that can:
β Add student record
β View student records
β Update student details
β Delete student record
Concepts Used:
β SQLite Database
β CRUD Operations
β Python Functions
βββββββββββββββββββ
π Step 1: Create Database & Table
import sqlite3
conn = sqlite3.connect("student.db")
cursor = conn.cursor()
cursor.execute(""" CREATE TABLE IF NOT EXISTS student( id INTEGER PRIMARY KEY, name TEXT, age INTEGER, course TEXT ) """)
conn.commit()
βββββββββββββββββββ
β Step 2: Insert Student Data
def add_student(id, name, age, course):
cursor.execute( "INSERT INTO student VALUES(?,?,?,?)", (id, name, age, course) )
conn.commit()
Example:
add_student(1,"Soham",20,"Python")
βββββββββββββββββββ
π Step 3: View Students
def view_students():
cursor.execute("SELECT * FROM student")
rows = cursor.fetchall()
for row in rows:
print(row)
βββββββββββββββββββ
β Step 4: Update Student
def update_student(id, age):
cursor.execute( "UPDATE student SET age=? WHERE id=?", (age,id) )
conn.commit()
βββββββββββββββββββ
β Step 5: Delete Student
def delete_student(id):
cursor.execute( "DELETE FROM student WHERE id=?", (id,) )
conn.commit()
βββββββββββββββββββ
π§ How the System Works?
1οΈβ£ User adds student
2οΈβ£ Data stored in database
3οΈβ£ User can view/update/delete records
Real-world concept:
β Database CRUD operations
βββββββββββββββββββ
π¨ Bonus Improvements
β Add menu system
β Add input validation
β Connect with Tkinter GUI
β Export data to CSV
βββββββββββββββββββ
π Practice Tasks β Day 44
β Create student database
β Insert 5 students
β Display all records
β Update one record
β Delete one record
βββββββββββββββββββ
π― Day 44 Goal
β Build database project
β Understand CRUD operations
β Use SQLite with Python
βββββββββββββββββββ
π Next Topic β Day 45
π₯ Web Scraping using Python (BeautifulSoup)
β¨ Stay Connected | Keep Coding
π TechByWebCoder
π PYTHON β DAY 45 STUDY MATERIAL
β¨ Topic: Web Scraping using Python (BeautifulSoup)
βββββββββββββββββββ
π What is Web Scraping?
Web scraping means extracting data from websites automatically using code.
Used for:
β Data collection
β Price tracking
β News aggregation
β Market research
βββββββββββββββββββ
π¦ Required Libraries
Install libraries:
pip install requests
pip install beautifulsoup4
Import in Python:
import requests
from bs4 import BeautifulSoup
βββββββββββββββββββ
π Step 1: Get Website HTML
import requests
url = "https://example.comβ οΏ½"
response = requests.get(url)
html = response.text
print(html)
This fetches the HTML source of the webpage.
βββββββββββββββββββ
π Step 2: Parse HTML using BeautifulSoup
from bs4 import BeautifulSoup
soup = BeautifulSoup(html, "html.parser")
print(soup.title)
Extracts the title of the webpage.
βββββββββββββββββββ
πΉ Extract Specific Data
Example: Get all headings
for heading in soup.find_all("h1"):
print(heading.text)
βββββββββββββββββββ
πΉ Extract Links from Page
for link in soup.find_all("a"):
print(link.get("href"))
βββββββββββββββββββ
πΉ Extract Paragraph Text
for p in soup.find_all("p"):
print(p.text)
βββββββββββββββββββ
β Important Note
Always check a websiteβs robots.txt before scraping.
Some websites do not allow scraping.
βββββββββββββββββββ
π§ Real-world Uses of Web Scraping
β Job listing collectors
β Product price trackers
β News aggregators
β Social media analysis
βββββββββββββββββββ
π Practice Tasks β Day 45
β Fetch website HTML
β Extract title
β Extract all links
β Extract paragraph text
βββββββββββββββββββ
π― Day 45 Goal
β Understand web scraping concept
β Use BeautifulSoup
β Extract structured data
βββββββββββββββββββ
π
π₯ Automating Tasks with Python (Automation Scripts)
β¨ Stay Connected | Keep Coding
π TechByWebCoder
β¨ Topic: Web Scraping using Python (BeautifulSoup)
βββββββββββββββββββ
π What is Web Scraping?
Web scraping means extracting data from websites automatically using code.
Used for:
β Data collection
β Price tracking
β News aggregation
β Market research
βββββββββββββββββββ
π¦ Required Libraries
Install libraries:
pip install requests
pip install beautifulsoup4
Import in Python:
import requests
from bs4 import BeautifulSoup
βββββββββββββββββββ
π Step 1: Get Website HTML
import requests
url = "https://example.comβ οΏ½"
response = requests.get(url)
html = response.text
print(html)
This fetches the HTML source of the webpage.
βββββββββββββββββββ
π Step 2: Parse HTML using BeautifulSoup
from bs4 import BeautifulSoup
soup = BeautifulSoup(html, "html.parser")
print(soup.title)
Extracts the title of the webpage.
βββββββββββββββββββ
πΉ Extract Specific Data
Example: Get all headings
for heading in soup.find_all("h1"):
print(heading.text)
βββββββββββββββββββ
πΉ Extract Links from Page
for link in soup.find_all("a"):
print(link.get("href"))
βββββββββββββββββββ
πΉ Extract Paragraph Text
for p in soup.find_all("p"):
print(p.text)
βββββββββββββββββββ
β Important Note
Always check a websiteβs robots.txt before scraping.
Some websites do not allow scraping.
βββββββββββββββββββ
π§ Real-world Uses of Web Scraping
β Job listing collectors
β Product price trackers
β News aggregators
β Social media analysis
βββββββββββββββββββ
π Practice Tasks β Day 45
β Fetch website HTML
β Extract title
β Extract all links
β Extract paragraph text
βββββββββββββββββββ
π― Day 45 Goal
β Understand web scraping concept
β Use BeautifulSoup
β Extract structured data
βββββββββββββββββββ
π
Next Topic β Day 46π₯ Automating Tasks with Python (Automation Scripts)
β¨ Stay Connected | Keep Coding
π TechByWebCoder
PYTHON β DAY 46 STUDY MATERIAL
β¨ Topic: Automating Tasks with Python
βββββββββββββββββββ
π What is Automation?
Automation means using code to perform repetitive tasks automatically.
Instead of doing work manually, Python can do it faster and automatically.
Examples:
β Renaming multiple files
β Sending emails automatically
β Data backup scripts
β Auto downloading files
βββββββββββββββββββ
π¦ Useful Python Modules for Automation
β os β File operations
β shutil β File moving/copying
β schedule β Task scheduling
β smtplib β Email automation
β pyautogui β Keyboard & mouse automation
βββββββββββββββββββ
π Example 1: List Files in Folder
import os
files = os.listdir()
for file in files:
print(file)
Shows all files in the current directory.
βββββββββββββββββββ
β Example 2: Rename Multiple Files
import os
files = os.listdir()
for i, file in enumerate(files):
os.rename(file, f"file_{i}.txt")
This renames files automatically π₯
βββββββββββββββββββ
π Example 3: Copy Files Automatically
import shutil
shutil.copy("source.txt", "backup.txt")
Used for file backup automation.
βββββββββββββββββββ
β° Example 4: Schedule Tasks
Install schedule library:
pip install schedule
Example:
import schedule
import time
def job():
print("Task executed")
schedule.every(5).seconds.do(job)
while True:
schedule.run_pending()
time.sleep(1)
Runs task every 5 seconds.
βββββββββββββββββββ
π§ Real-world Automation Examples
β Auto email sender
β Auto report generator
β File organizer
β Social media automation
βββββββββββββββββββ
π Practice Tasks β Day 46
β List files in directory
β Rename files automatically
β Copy file backup
β Schedule a task
βββββββββββββββββββ
π― Day 46 Goal
β Understand automation concept
β Use OS & file modules
β Create simple automation scripts
βββββββββββββββββββ
π Next Topic β Day 47
π₯ Sending Emails using Python
β¨ Stay Connected | Keep Coding
π TechByWebCoder
β¨ Topic: Automating Tasks with Python
βββββββββββββββββββ
π What is Automation?
Automation means using code to perform repetitive tasks automatically.
Instead of doing work manually, Python can do it faster and automatically.
Examples:
β Renaming multiple files
β Sending emails automatically
β Data backup scripts
β Auto downloading files
βββββββββββββββββββ
π¦ Useful Python Modules for Automation
β os β File operations
β shutil β File moving/copying
β schedule β Task scheduling
β smtplib β Email automation
β pyautogui β Keyboard & mouse automation
βββββββββββββββββββ
π Example 1: List Files in Folder
import os
files = os.listdir()
for file in files:
print(file)
Shows all files in the current directory.
βββββββββββββββββββ
β Example 2: Rename Multiple Files
import os
files = os.listdir()
for i, file in enumerate(files):
os.rename(file, f"file_{i}.txt")
This renames files automatically π₯
βββββββββββββββββββ
π Example 3: Copy Files Automatically
import shutil
shutil.copy("source.txt", "backup.txt")
Used for file backup automation.
βββββββββββββββββββ
β° Example 4: Schedule Tasks
Install schedule library:
pip install schedule
Example:
import schedule
import time
def job():
print("Task executed")
schedule.every(5).seconds.do(job)
while True:
schedule.run_pending()
time.sleep(1)
Runs task every 5 seconds.
βββββββββββββββββββ
π§ Real-world Automation Examples
β Auto email sender
β Auto report generator
β File organizer
β Social media automation
βββββββββββββββββββ
π Practice Tasks β Day 46
β List files in directory
β Rename files automatically
β Copy file backup
β Schedule a task
βββββββββββββββββββ
π― Day 46 Goal
β Understand automation concept
β Use OS & file modules
β Create simple automation scripts
βββββββββββββββββββ
π Next Topic β Day 47
π₯ Sending Emails using Python
β¨ Stay Connected | Keep Coding
π TechByWebCoder
π PYTHON β DAY 47 STUDY MATERIAL
β¨ Topic: Sending Emails using Python
βββββββββββββββββββ
π Why Send Emails with Python?
Python can automate email tasks like:
β Sending notifications
β Sending reports automatically
β Sending OTP messages
β Marketing email automation
βββββββββββββββββββ
π¦ Required Module
Python provides built-in module:
smtplib
Used to send emails using SMTP (Simple Mail Transfer Protocol).
βββββββββββββββββββ
π§ Basic Email Sending Example
import smtplib
sender = "your_email@gmail.com"
receiver = "receiver_email@gmail.com"
password = "your_app_password"
message = "Hello! This email was sent using Python."
server = smtplib.SMTP("smtp.gmail.com", 587)
server.starttls()
server.login(sender, password)
server.sendmail(sender, receiver, message)
server.quit()
print("Email Sent Successfully β ")
βββββββββββββββββββ
π Important: Use App Password
For Gmail you must use App Password, not your main password.
Steps:
1οΈβ£ Go to Google Account
2οΈβ£ Security β App Passwords
3οΈβ£ Generate password for Mail
4οΈβ£ Use that password in Python
βββββββββββββββββββ
π Sending Email with Subject
from email.mime.text import MIMEText
message = MIMEText("Hello from Python!")
message["Subject"] = "Python Email Test"
message["From"] = sender
message["To"] = receiver
βββββββββββββββββββ
π Sending Email with Attachment (Concept)
Modules used:
β email
β smtplib
β MIMEBase
This allows sending:
π PDFs
π· Images
π Reports
βββββββββββββββββββ
π§ Real-world Uses
β Daily report email automation
β Alert systems
β Customer notifications
β Password reset emails
βββββββββββββββββββ
π Practice Tasks β Day 47
β Send simple email
β Add subject line
β Send email to yourself
β Try adding attachment
βββββββββββββββββββ
π― Day 47 Goal
β Understand SMTP
β Send email using Python
β Learn email automation basics
βββββββββββββββββββ
π Next Topic β Day 48
π₯ Multithreading in Python
β¨ Stay Connected | Keep Coding
π TechByWebCoder
β¨ Topic: Sending Emails using Python
βββββββββββββββββββ
π Why Send Emails with Python?
Python can automate email tasks like:
β Sending notifications
β Sending reports automatically
β Sending OTP messages
β Marketing email automation
βββββββββββββββββββ
π¦ Required Module
Python provides built-in module:
smtplib
Used to send emails using SMTP (Simple Mail Transfer Protocol).
βββββββββββββββββββ
π§ Basic Email Sending Example
import smtplib
sender = "your_email@gmail.com"
receiver = "receiver_email@gmail.com"
password = "your_app_password"
message = "Hello! This email was sent using Python."
server = smtplib.SMTP("smtp.gmail.com", 587)
server.starttls()
server.login(sender, password)
server.sendmail(sender, receiver, message)
server.quit()
print("Email Sent Successfully β ")
βββββββββββββββββββ
π Important: Use App Password
For Gmail you must use App Password, not your main password.
Steps:
1οΈβ£ Go to Google Account
2οΈβ£ Security β App Passwords
3οΈβ£ Generate password for Mail
4οΈβ£ Use that password in Python
βββββββββββββββββββ
π Sending Email with Subject
from email.mime.text import MIMEText
message = MIMEText("Hello from Python!")
message["Subject"] = "Python Email Test"
message["From"] = sender
message["To"] = receiver
βββββββββββββββββββ
π Sending Email with Attachment (Concept)
Modules used:
β email
β smtplib
β MIMEBase
This allows sending:
π PDFs
π· Images
π Reports
βββββββββββββββββββ
π§ Real-world Uses
β Daily report email automation
β Alert systems
β Customer notifications
β Password reset emails
βββββββββββββββββββ
π Practice Tasks β Day 47
β Send simple email
β Add subject line
β Send email to yourself
β Try adding attachment
βββββββββββββββββββ
π― Day 47 Goal
β Understand SMTP
β Send email using Python
β Learn email automation basics
βββββββββββββββββββ
π Next Topic β Day 48
π₯ Multithreading in Python
β¨ Stay Connected | Keep Coding
π TechByWebCoder
π PYTHON β DAY 48 STUDY MATERIAL
β¨ Topic: Multithreading in Python
βββββββββββββββββββ
π What is Multithreading?
Multithreading allows a program to run multiple tasks at the same time.
Instead of executing tasks one by one, Python can run them concurrently.
Example:
β Download multiple files simultaneously
β Handle multiple users in a server
β Perform background tasks
βββββββββββββββββββ
β‘ Thread vs Process
Thread β Lightweight task inside a program
Process β Independent running program
Multithreading helps improve performance for many tasks.
βββββββββββββββββββ
π¦ Threading Module
Python provides built-in module:
import threading
βββββββββββββββββββ
πΉ Creating a Thread
import threading
def task():
print("Thread is running")
t = threading.Thread(target=task)
t.start()
This starts a new thread.
βββββββββββββββββββ
πΉ Running Multiple Threads
import threading
def task():
print("Thread executed")
t1 = threading.Thread(target=task)
t2 = threading.Thread(target=task)
t1.start()
t2.start()
Both tasks run simultaneously π₯
βββββββββββββββββββ
πΉ Using join()
join() makes main program wait for thread to finish.
t1.start()
t1.join()
print("Thread finished")
βββββββββββββββββββ
πΉ Example with Delay
import threading
import time
def task():
print("Task started")
time.sleep(2)
print("Task completed")
t = threading.Thread(target=task)
t.start()
βββββββββββββββββββ
π§ Where Multithreading is Used?
β Web servers
β Game development
β File downloads
β Background processing
βββββββββββββββββββ
π Practice Tasks β Day 48
β Create one thread
β Run two threads
β Use join()
β Add delay using time.sleep()
βββββββββββββββββββ
π― Day 48 Goal
β Understand threading concept
β Create and run threads
β Improve program efficiency
βββββββββββββββββββ
π Next Topic β Day 49
π₯ Multiprocessing in Python
β¨ Stay Connected | Keep Coding
π TechByWebCoder
β¨ Topic: Multithreading in Python
βββββββββββββββββββ
π What is Multithreading?
Multithreading allows a program to run multiple tasks at the same time.
Instead of executing tasks one by one, Python can run them concurrently.
Example:
β Download multiple files simultaneously
β Handle multiple users in a server
β Perform background tasks
βββββββββββββββββββ
β‘ Thread vs Process
Thread β Lightweight task inside a program
Process β Independent running program
Multithreading helps improve performance for many tasks.
βββββββββββββββββββ
π¦ Threading Module
Python provides built-in module:
import threading
βββββββββββββββββββ
πΉ Creating a Thread
import threading
def task():
print("Thread is running")
t = threading.Thread(target=task)
t.start()
This starts a new thread.
βββββββββββββββββββ
πΉ Running Multiple Threads
import threading
def task():
print("Thread executed")
t1 = threading.Thread(target=task)
t2 = threading.Thread(target=task)
t1.start()
t2.start()
Both tasks run simultaneously π₯
βββββββββββββββββββ
πΉ Using join()
join() makes main program wait for thread to finish.
t1.start()
t1.join()
print("Thread finished")
βββββββββββββββββββ
πΉ Example with Delay
import threading
import time
def task():
print("Task started")
time.sleep(2)
print("Task completed")
t = threading.Thread(target=task)
t.start()
βββββββββββββββββββ
π§ Where Multithreading is Used?
β Web servers
β Game development
β File downloads
β Background processing
βββββββββββββββββββ
π Practice Tasks β Day 48
β Create one thread
β Run two threads
β Use join()
β Add delay using time.sleep()
βββββββββββββββββββ
π― Day 48 Goal
β Understand threading concept
β Create and run threads
β Improve program efficiency
βββββββββββββββββββ
π Next Topic β Day 49
π₯ Multiprocessing in Python
β¨ Stay Connected | Keep Coding
π TechByWebCoder
π PYTHON β DAY 49 STUDY MATERIAL
β¨ Topic: Multiprocessing in Python
βββββββββββββββββββ
π What is Multiprocessing?
Multiprocessing means running multiple processes simultaneously using multiple CPU cores.
Unlike multithreading, each process runs independently.
Example:
β Video processing
β Large data analysis
β Machine learning tasks
β High-performance computing
βββββββββββββββββββ
β‘ Thread vs Process
Thread β Runs inside same program memory
Process β Runs in separate memory space
Multiprocessing uses multiple CPU cores, making programs faster.
βββββββββββββββββββ
π¦ Multiprocessing Module
Python provides built-in module:
import multiprocessing
βββββββββββββββββββ
πΉ Creating a Process
import multiprocessing
def task():
print("Process running")
p = multiprocessing.Process(target=task)
p.start()
This creates a new process.
βββββββββββββββββββ
πΉ Running Multiple Processes
import multiprocessing
def task():
print("Process executed")
p1 = multiprocessing.Process(target=task)
p2 = multiprocessing.Process(target=task)
p1.start()
p2.start()
Both processes run in parallel π₯
βββββββββββββββββββ
πΉ Using join()
join() waits for process completion.
p1.start()
p1.join()
print("Process finished")
βββββββββββββββββββ
πΉ Example with CPU Work
import multiprocessing
import time
def task():
for i in range(5):
print("Processing", i)
time.sleep(1)
p = multiprocessing.Process(target=task)
p.start()
βββββββββββββββββββ
π§ Where Multiprocessing is Used?
β Data science
β Machine learning
β Image processing
β Scientific computing
βββββββββββββββββββ
π Practice Tasks β Day 49
β Create a process
β Run two processes
β Use join()
β Add loop processing
βββββββββββββββββββ
π― Day 49 Goal
β Understand multiprocessing concept
β Run parallel processes
β Use multiple CPU cores
βββββββββββββββββββ
π Next Topic β Day 50
π₯ Logging in Python
β¨ Stay Connected | Keep Coding
π TechByWebCoder
β¨ Topic: Multiprocessing in Python
βββββββββββββββββββ
π What is Multiprocessing?
Multiprocessing means running multiple processes simultaneously using multiple CPU cores.
Unlike multithreading, each process runs independently.
Example:
β Video processing
β Large data analysis
β Machine learning tasks
β High-performance computing
βββββββββββββββββββ
β‘ Thread vs Process
Thread β Runs inside same program memory
Process β Runs in separate memory space
Multiprocessing uses multiple CPU cores, making programs faster.
βββββββββββββββββββ
π¦ Multiprocessing Module
Python provides built-in module:
import multiprocessing
βββββββββββββββββββ
πΉ Creating a Process
import multiprocessing
def task():
print("Process running")
p = multiprocessing.Process(target=task)
p.start()
This creates a new process.
βββββββββββββββββββ
πΉ Running Multiple Processes
import multiprocessing
def task():
print("Process executed")
p1 = multiprocessing.Process(target=task)
p2 = multiprocessing.Process(target=task)
p1.start()
p2.start()
Both processes run in parallel π₯
βββββββββββββββββββ
πΉ Using join()
join() waits for process completion.
p1.start()
p1.join()
print("Process finished")
βββββββββββββββββββ
πΉ Example with CPU Work
import multiprocessing
import time
def task():
for i in range(5):
print("Processing", i)
time.sleep(1)
p = multiprocessing.Process(target=task)
p.start()
βββββββββββββββββββ
π§ Where Multiprocessing is Used?
β Data science
β Machine learning
β Image processing
β Scientific computing
βββββββββββββββββββ
π Practice Tasks β Day 49
β Create a process
β Run two processes
β Use join()
β Add loop processing
βββββββββββββββββββ
π― Day 49 Goal
β Understand multiprocessing concept
β Run parallel processes
β Use multiple CPU cores
βββββββββββββββββββ
π Next Topic β Day 50
π₯ Logging in Python
β¨ Stay Connected | Keep Coding
π TechByWebCoder
π PYTHON β DAY 50 STUDY MATERIAL
β¨ Topic: Logging in Python
βββββββββββββββββββ
π What is Logging?
Logging is used to record events that happen while a program runs.
Instead of using print() everywhere, developers use logging to track:
β Errors
β Warnings
β Debug information
β Application activity
βββββββββββββββββββ
π¦ Logging Module
Python provides a built-in module:
import logging
βββββββββββββββββββ
πΉ Basic Logging Example
import logging
logging.basicConfig(level=logging.DEBUG)
logging.debug("Debug message")
logging.info("Information message")
logging.warning("Warning message")
logging.error("Error occurred")
logging.critical("Critical issue")
βββββββββββββββββββ
π Logging Levels
DEBUG β Detailed information
INFO β General program events
WARNING β Something unexpected
ERROR β Program error
CRITICAL β Serious failure
βββββββββββββββββββ
π Logging to a File
import logging
logging.basicConfig( filename="app.log", level=logging.INFO )
logging.info("Application started")
This creates a log file automatically.
βββββββββββββββββββ
β° Logging with Time Format
import logging
logging.basicConfig( filename="app.log", level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s" )
logging.info("Program started")
Example output:
2026-03-16 21:45:22 - INFO - Program started
βββββββββββββββββββ
π§ Why Logging is Important?
β Debugging large programs
β Monitoring applications
β Tracking errors in production
β Maintaining software systems
βββββββββββββββββββ
π Practice Tasks β Day 50
β Use logging instead of print
β Create log file
β Log errors and warnings
β Add time format
βββββββββββββββββββ
π― Day 50 Goal
β Understand logging system
β Track application events
β Improve debugging skills
βββββββββββββββββββ
π Next Topic β Day 51
π₯ Command Line Arguments in Python
β¨ Stay Connected | Keep Coding
π TechByWebCoder
β¨ Topic: Logging in Python
βββββββββββββββββββ
π What is Logging?
Logging is used to record events that happen while a program runs.
Instead of using print() everywhere, developers use logging to track:
β Errors
β Warnings
β Debug information
β Application activity
βββββββββββββββββββ
π¦ Logging Module
Python provides a built-in module:
import logging
βββββββββββββββββββ
πΉ Basic Logging Example
import logging
logging.basicConfig(level=logging.DEBUG)
logging.debug("Debug message")
logging.info("Information message")
logging.warning("Warning message")
logging.error("Error occurred")
logging.critical("Critical issue")
βββββββββββββββββββ
π Logging Levels
DEBUG β Detailed information
INFO β General program events
WARNING β Something unexpected
ERROR β Program error
CRITICAL β Serious failure
βββββββββββββββββββ
π Logging to a File
import logging
logging.basicConfig( filename="app.log", level=logging.INFO )
logging.info("Application started")
This creates a log file automatically.
βββββββββββββββββββ
β° Logging with Time Format
import logging
logging.basicConfig( filename="app.log", level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s" )
logging.info("Program started")
Example output:
2026-03-16 21:45:22 - INFO - Program started
βββββββββββββββββββ
π§ Why Logging is Important?
β Debugging large programs
β Monitoring applications
β Tracking errors in production
β Maintaining software systems
βββββββββββββββββββ
π Practice Tasks β Day 50
β Use logging instead of print
β Create log file
β Log errors and warnings
β Add time format
βββββββββββββββββββ
π― Day 50 Goal
β Understand logging system
β Track application events
β Improve debugging skills
βββββββββββββββββββ
π Next Topic β Day 51
π₯ Command Line Arguments in Python
β¨ Stay Connected | Keep Coding
π TechByWebCoder