LearnPy Hub
← Pandas: Cleaning & Preprocessing problems
Medium

Min-Max Scaling

Add a column scaled = (amount − min) / (max − min), so the smallest amount becomes 0 and the largest 1 (if all amounts are equal, use 0). Print each amount scaled with scaled to 2 decimals.

Input

Lines 'date region product amount', then END.

Output

Lines.

Sample 1

Input
2026-01-15 Dhaka Tea 500
2026-01-20 Sylhet Tea 300
2026-02-03 Dhaka Rice 1200
2026-02-18 Khulna Tea 450
2026-03-07 Sylhet Rice 800
2026-03-21 Dhaka Tea 650
END
Output
500 0.22
300 0.00
1200 1.00
450 0.17
800 0.56
650 0.39

Sample 2

Input
2026-05-01 Dhaka Tea 100
END
Output
100 0.00
solution.py
Output appears here
Min-Max Scaling · Python practice problem · LearnPy Hub