LearnPy Hub
← Pandas: Cleaning & Preprocessing problems
Medium

Rolling Average

Sort the sales by date and print the 2-sale rolling average of the amount (rolling(2).mean()) for every row from the second one on, with 1 decimal, on one line. Print none if there is only one sale.

Input

Lines 'date region product amount', then END.

Output

One line.

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
400.0 750.0 825.0 625.0 725.0

Sample 2

Input
2026-05-01 Dhaka Tea 100
END
Output
none
solution.py
Output appears here
Rolling Average · Python practice problem · LearnPy Hub