LearnPy Hub
← Pandas: Cleaning & Preprocessing problems
Hard

Did Each Region Hit Its Target?

After the sales, target lines region target follow until a second END. Left-merge the targets onto the regional totals (regions without a target get 0 target), and print REGION TOTAL TARGET STATUS in alphabetical order, where STATUS is met, missed or no target.

Input

Sales, END, targets, 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
Dhaka 2000
Sylhet 1500
END
Output
Dhaka 2350 2000 met
Khulna 450 0 no target
Sylhet 1100 1500 missed

Sample 2

Input
2026-05-01 Dhaka Tea 100
END
Dhaka 100
END
Output
Dhaka 100 100 met
solution.py
Output appears here
Did Each Region Hit Its Target? · Python practice problem · LearnPy Hub