Exercise 1: Advanced Employee Records Management (2points)
Here I have implemented an advanced employee records management system using Python data class
as requested by the professor. The program supports the following; adding, updating, and displaying employee information, and also supports the calculation of the average performance scores and identifying top performers which you can see below.
Code
Output
Interpretation
Employee Dataclass: This contains the following;
Defines an
Employee
withname, id, salary, position
andscores performance
.The
average_score
is what helps to calculate the employee average score performance.EmployeeRecords Class:
This manages a list of employees and provides methods they can add, display, update, identify top performers, and calculate average scores. In the code, other classes help to display all employees alongside their average scores performance
display_employees
and a class that returns the average performance score for a specific employeecalculate_average_scores
.
In the program, the top performers are;
- ID: 1, Name: Josepha, Average Score: 4.70
- ID: 3, Name: Kouba01, Average Score: 4.70
Exercise 2: Comprehensive Student Grades Analysis (2points)
Here I have shared a program that uses NumPy structured arrays to store and analyze student grades as requested by the professor. The program also has functions that calculate averages, identify top students, analyze subject-wise performance, etc which you can see below.
Code:
Output
Interpretation
Structured Array: In the program the structured Array is defined as
student_dtype
to include fields forstudent_id
,name
, and grades for each of the subjects; Mathematics, Science, English, and History.Functions: This helps us to calculate each student's average grade by averaging the four subject grades which the class name is
calculate_average_grade
and other classes that identify students with average grades above a specified threshold.
Exercise 3: Enhanced Inventory Management System (2points)
Here I have implemented an enhanced inventory management system using named tuple
which is a Python program to track products. In the program, there are functions to add products, update quantities, generate low stock alerts, etc which you can see below.
Code
Output
The program especially the code provided us with a comprehensive inventory management system that can be further expanded with additional functionalities like product removal or tracking product suppliers.
Exercise 4: Advanced Customer Orders Processing (2points)
Here I have created a program that uses NumPy structured arrays to process customer orders as requested by the professor. This program includes several functions for calculating order totals, identifying large orders, analyzing customer spending, and as well finding frequently ordered products as seen below.
Interpretation
The Order structured Array: We can define a structured Array order"type
, with a field for order_id
, customer_name
, product,
quantity,
order date, and
price_per_unit`.
- To track pairs of products ordered on the same date by the same customer, display pairs ordered together more than once a
frequently_ordered_together
function which usescounter
is been used.
Exercise 5: In-Depth Weather Data Analysis (2points)
Here I have implemented an in-depth weather data analysis using dataclass
and NumPy. The program includes functionalities for calculating averages, identifying trends, and detecting anomalies in weather data which you can see below.
Interpretation
- Convert to NumPy Array:
- This is where the weather data is stored as a list of
WeatherRecord
instances. - The
convert_to_numpy
function then converts the list into a structured NumPy Array for efficient numerical operations.
Functions:
The
calculate_averages
computes average temperature, max humidity, total precipitation, and average wind speed using the function of NumPy.identify_temperature_thresholds
: This finds days where temperatures are below or above specified thresholds.detect_trends
: this makes use ofnp. Diff
to calculate the differences between consecutive values and detect the overall trend.detect_anomalies
: this identified sudden drops or spikes in temperature usingnipdiff
and a specified threshold.
I am inviting; @dove11, @simonmwigwe, and @ruthjoe
Cc:-
@kouba01
You are really doing a very great job. You must have really invested so much of time and energy in this post. This is really highly commendable
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit