0% found this document useful (0 votes)
20 views3 pages

Module 3 Assignments

Uploaded by

udipi.adithya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views3 pages

Module 3 Assignments

Uploaded by

udipi.adithya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Module 3: Assignment 1

Objective: To understand how to leverage ChatGPT for various tasks related to Excel

Task: You are given the sales data of a company in different regions over a period of time.
The data is provided in the excel format. Download the data set and use ChatGPT to
generate the formulas for the following tasks. Put the formulas at relevant places and
verify if the desired results are generated.
1. A formula to calculate the moving average of the Total Sales over a 7-day period.
2. A formula to categorize sales into different regions automatically.
3. A formula to identify sales anomalies (values significantly higher or lower than the
average).

Solutions:
Task 1: Moving Average of Sales Data
Objective: Calculate the moving average of the Total Sales over a 7-day period.
Solution: Use the following formula in Excel to calculate the 7-day moving average for Total
Sales. This formula assumes the Total Sales values are in column G, starting from row 2:

=AVERAGE(G2:G8)

Drag this formula down to calculate the moving average for the entire dataset.
Task 2: Categorize Sales into Different Regions Automatically
Assuming the Region values are in column C, you can use a CHOOSE function to categorize
the sales data. For example:
less
Copy code

=CHOOSE(MATCH(C2, {"North", "South", "East", "West"}, 0), "Region 1",


"Region 2", "Region 3", "Region 4")

This formula matches the region name to the array and assigns a corresponding category.

Task 3: Identify Sales Anomalies


First, calculate the average and standard deviation of Total Sales:
● Average (assuming Total Sales values are in column G):

=AVERAGE(G2:G301)

● Standard Deviation:
=STDEV.P(G2:G301)

Then, use the following formula to flag anomalies (values more than 2 standard deviations
away from the mean). This formula assumes the average and standard deviation are in cells
H1 and H2, respectively:

=IF(OR(G2 > $H$1 + 2 * $H$2, G2 < $H$1 - 2 * $H$2), "Anomaly", "Normal")

Drag this formula down to apply it to the entire dataset.


Module 3: Assignment 2

Objective:
To learn how to use Debugcode.ai for identifying and fixing bugs in Python code.
1. Tasks:
Please read the Python code to find some statistical values from a given data. The code has
some syntax based and formula based errors. Use DebudCode.ai to identify the following
possible errors in the code.
1. Incorrect calculation of variance.
2. Inaccurate standard deviation calculation.

Provided Python Code with Bugs:

def calculate_statistics(data):
total = sum(data)
mean = total / len(data)
variance = sum((x - mean) ** 2 for x in data) / len(data) - 1
std_dev = variance ** 0.5
return mean, variance, std_dev

def process_data(data):
mean, variance, std_dev = calculate_statistics(data)
print(f"Mean: {mean}")
print(f"Variance: {variance}")
print(f"Standard Deviation: {std_dev}")

data = [2, 4, 6, 8, 10]


process_data(data)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy