See attachedfrom openpyxl import load_workbook # Open the SalesData spreadsheet workbook = load_workbook(“SalesData.xlsx”) sheet =

See attached

from openpyxl import load_workbook

# Open the SalesData spreadsheet
workbook = load_workbook(“SalesData.xlsx”)
sheet = workbook.active

# Grab columns A (Date), C (Rep), and G (Total Sales), except title row
gridData = sheet.iter_rows(min_row=2, min_col=1, max_col=7, values_only=True)

# Convert that data into a list, filtering out non-numeric sales values
salesList = []
salesDetails = [] # List to store details (date, rep, and total sale)

for nextRow in gridData:
date = nextRow[0] # Date is in column A (index 0)
rep = nextRow[2] # Salesperson is in column C (index 2)
total_sale = nextRow[6] # Total sale is in column G (index 6)

# Check if the total sale is numeric (to avoid errors from text or blank cells)
if isinstance(total_sale, (int, float)):
salesList.append(total_sale)
salesDetails.append((date, rep, total_sale)) # Store corresponding details

# Find the index of the largest sale
if salesList:
max_sale = max(salesList)
max_index = salesList.index(max_sale)

# Get the corresponding date and salesperson from the salesDetails list
max_sale_date, max_sale_rep, max_sale_value = salesDetails[max_index]

# Print the result
print(f”Largest Sale was {max_sale_value} made on {max_sale_date} by {max_sale_rep}”)
else:
print(“No valid sales data found.”)

Share This Post

Email
WhatsApp
Facebook
Twitter
LinkedIn
Pinterest
Reddit

Order a Similar Paper and get 15% Discount on your First Order

Related Questions

Capstone 2408906454Design and Analysis of a Simple Computer SystemObjective:

Capstone 2408906454 Design and Analysis of a Simple Computer System Objective: Students will design, simulate, and analyze the architecture of a simplified computer system, applying concepts from Stephen D. Burd’s materials such as the CPU, memory hierarchy, I/O, and instruction set architecture (ISA). Components: 1. System Design: . CPU Design:

System Analysis and Design Assignment 13,1 – Data Management

System Analysis and Design Assignment 13,1 – Data Management This is a required assignment, worth 20 points, and must be submitted by the due date. Review the Grading Rubric before completing this assignment. Research a scholarly paper on the impact of “Emerging Technologies on SAD” and reflect on only one

Capstone 2408906454Design and Analysis of a Simple Computer SystemObjective:

Capstone 2408906454 Design and Analysis of a Simple Computer System Objective: Students will design, simulate, and analyze the architecture of a simplified computer system, applying concepts from Stephen D. Burd’s materials such as the CPU, memory hierarchy, I/O, and instruction set architecture (ISA). Components: 1. System Design: . CPU Design: