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

Project 29: Price vs. Sales Correlation

Scientific Computing
Current Task

Objective

Review day: combine correlation and distance — days 17 and 11 — to compare price and sales trends.

Task: compute the correlation and the Euclidean distance between a price array and a sales array, and print both rounded.

index.py
from scipy.spatial.distance import euclidean from scipy.stats import pearsonr import numpy as np price = np.array([10, 20, 30, 40]) sales = np.array([100, 80, 60, 40]) correlation, _ = pearsonr(price, sales) distance = euclidean(price, sales) print(round(correlation, 3)) print(round(distance, 2))

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

Live Preview
🖼️

Verify your code to see the preview