🚀 LEVEL UP TO SENIOR:Unlock 500+ Advanced Practical Challenges & Exercises.
🎓 COURSERA PARTNER:Earn professional Google, Meta, and IBM certificates to supercharge your resume.

Project 30: Regional Sales Report

Scientific Computing
Current Task

Objective

Capstone: combine statistics, spatial queries, and optimization — the three pillars of this track — into one real admin report.

Task: test whether two regions' sales differ significantly, find the store nearest a target location, and fit a target sales value — printing all three results.

index.py
from scipy.optimize import minimize from scipy.stats import ttest_ind from scipy.spatial import KDTree import numpy as np region_a_sales = [500, 520, 480, 510] region_b_sales = [600, 615, 590, 605] significance = ttest_ind(region_a_sales, region_b_sales) store_locations = np.array([[0, 0], [10, 10], [5, 5], [2, 8]]) tree = KDTree(store_locations) nearest_distance, nearest_index = tree.query([4, 4]) def target_cost(x): return (x[0] - 550) ** 2 result = minimize(target_cost, x0=[0]) print(round(significance.pvalue, 5)) print(nearest_distance, nearest_index) print(result.x.round(2))

* Hint: Correct characters turn green, incorrect ones turn red.

Live Preview
🖼️

Verify your code to see the preview

Previous
Next →