Python LAB MANUAL
Name of Institution/Department
Course Name and Code
Semester and Year
Index
Experiment No. Experiment Title
Experiment 1 Title of Experiment 1
Experiment 2 Title of Experiment 2
Experiment 3 Title of Experiment 3
Experiment 4 Title of Experiment 4
Experiment 5 Title of Experiment 5
Experiment 6 Title of Experiment 6
Experiment 7 Title of Experiment 7
Experiment 8 Title of Experiment 8
Experiment 9 Title of Experiment 9
Experiment 10 Title of Experiment 10
Experiment No. 1
Title:
[Write the title of the experiment here]
Objective:
[Clearly state the objective or purpose of the experiment.]
Design and Algorithms:
1. Design:
[Provide the design or flowchart explaining the workflow of the experiment.]
2. Algorithm:
[List down the step-by-step algorithm for the implementation.]
Python Code:
[Insert the Python code here with proper comments.]
Output:
[Insert the output in the form of screenshots or graphical outputs.]
Result:
[Summarize the result achieved from the experiment.]
Discussion:
[Discuss the findings, challenges, and possible improvements.]
Instructor:
Date:
Experiment No. 2
Title:
[Write the title of the experiment here]
Objective:
[Clearly state the objective or purpose of the experiment.]
Design and Algorithms:
1. Design:
[Provide the design or flowchart explaining the workflow of the experiment.]
2. Algorithm:
[List down the step-by-step algorithm for the implementation.]
Python Code:
[Insert the Python code here with proper comments.]
Output:
[Insert the output in the form of screenshots or graphical outputs.]
Result:
[Summarize the result achieved from the experiment.]
Discussion:
[Discuss the findings, challenges, and possible improvements.]
Instructor:
Date:
Experiment No. 3
Title:
[Write the title of the experiment here]
Objective:
[Clearly state the objective or purpose of the experiment.]
Design and Algorithms:
1. Design:
[Provide the design or flowchart explaining the workflow of the experiment.]
2. Algorithm:
[List down the step-by-step algorithm for the implementation.]
Python Code:
[Insert the Python code here with proper comments.]
Output:
[Insert the output in the form of screenshots or graphical outputs.]
Result:
[Summarize the result achieved from the experiment.]
Discussion:
[Discuss the findings, challenges, and possible improvements.]
Instructor:
Date:
Experiment No. 4
Title:
[Write the title of the experiment here]
Objective:
[Clearly state the objective or purpose of the experiment.]
Design and Algorithms:
1. Design:
[Provide the design or flowchart explaining the workflow of the experiment.]
2. Algorithm:
[List down the step-by-step algorithm for the implementation.]
Python Code:
[Insert the Python code here with proper comments.]
Output:
[Insert the output in the form of screenshots or graphical outputs.]
Result:
[Summarize the result achieved from the experiment.]
Discussion:
[Discuss the findings, challenges, and possible improvements.]
Instructor:
Date:
Experiment No. 5
Title:
[Write the title of the experiment here]
Objective:
[Clearly state the objective or purpose of the experiment.]
Design and Algorithms:
1. Design:
[Provide the design or flowchart explaining the workflow of the experiment.]
2. Algorithm:
[List down the step-by-step algorithm for the implementation.]
Python Code:
[Insert the Python code here with proper comments.]
Output:
[Insert the output in the form of screenshots or graphical outputs.]
Result:
[Summarize the result achieved from the experiment.]
Discussion:
[Discuss the findings, challenges, and possible improvements.]
Instructor:
Date:
Experiment No. 6
Title:
[Write the title of the experiment here]
Objective:
[Clearly state the objective or purpose of the experiment.]
Design and Algorithms:
1. Design:
[Provide the design or flowchart explaining the workflow of the experiment.]
2. Algorithm:
[List down the step-by-step algorithm for the implementation.]
Python Code:
[Insert the Python code here with proper comments.]
Output:
[Insert the output in the form of screenshots or graphical outputs.]
Result:
[Summarize the result achieved from the experiment.]
Discussion:
[Discuss the findings, challenges, and possible improvements.]
Instructor:
Date:
Experiment No. 7
Title:
[Write the title of the experiment here]
Objective:
[Clearly state the objective or purpose of the experiment.]
Design and Algorithms:
1. Design:
[Provide the design or flowchart explaining the workflow of the experiment.]
2. Algorithm:
[List down the step-by-step algorithm for the implementation.]
Python Code:
[Insert the Python code here with proper comments.]
Output:
[Insert the output in the form of screenshots or graphical outputs.]
Result:
[Summarize the result achieved from the experiment.]
Discussion:
[Discuss the findings, challenges, and possible improvements.]
Instructor:
Date:
Experiment No. 8
Title:
[Write the title of the experiment here]
Objective:
[Clearly state the objective or purpose of the experiment.]
Design and Algorithms:
1. Design:
[Provide the design or flowchart explaining the workflow of the experiment.]
2. Algorithm:
[List down the step-by-step algorithm for the implementation.]
Python Code:
[Insert the Python code here with proper comments.]
Output:
[Insert the output in the form of screenshots or graphical outputs.]
Result:
[Summarize the result achieved from the experiment.]
Discussion:
[Discuss the findings, challenges, and possible improvements.]
Instructor:
Date:
Experiment No. 9
Title:
[Write the title of the experiment here]
Objective:
[Clearly state the objective or purpose of the experiment.]
Design and Algorithms:
1. Design:
[Provide the design or flowchart explaining the workflow of the experiment.]
2. Algorithm:
[List down the step-by-step algorithm for the implementation.]
Python Code:
[Insert the Python code here with proper comments.]
Output:
[Insert the output in the form of screenshots or graphical outputs.]
Result:
[Summarize the result achieved from the experiment.]
Discussion:
[Discuss the findings, challenges, and possible improvements.]
Instructor:
Date:
Experiment No. 10
Title:
[Write the title of the experiment here]
Objective:
[Clearly state the objective or purpose of the experiment.]
Design and Algorithms:
1. Design:
[Provide the design or flowchart explaining the workflow of the experiment.]
2. Algorithm:
[List down the step-by-step algorithm for the implementation.]
Python Code:
[Insert the Python code here with proper comments.]
Output:
[Insert the output in the form of screenshots or graphical outputs.]
Result:
[Summarize the result achieved from the experiment.]
Discussion:
[Discuss the findings, challenges, and possible improvements.]
Instructor:
Date:
import socket
import time
import tracemalloc
# Start memory and time tracking
tracemalloc.start()
start_time = time.time()
# Get the local IP address
hostname = socket.gethostname()
ip_address = socket.gethostbyname(hostname)
# Perform any task (example: printing the IP address)
print(f"IP Address: {ip_address}")
# End time and memory tracking
end_time = time.time()
current_memory, peak_memory = tracemalloc.get_traced_memory()
tracemalloc.stop()
# Calculate time taken and memory used
time_taken = end_time - start_time
memory_used = current_memory / 1024 # Convert to KB
peak_memory_used = peak_memory / 1024 # Convert to KB
# Display results
print(f"Time Taken: {time_taken:.6f} seconds")
print(f"Current Memory Used: {memory_used:.2f} KB")
print(f"Peak Memory Used: {peak_memory_used:.2f} KB")
Code to be reused in every program the output is necessary to be shown in every program