Project Year-End Revenue

Easy ⏱ 8 min 77% acceptance ★★★★★ 4.7
Write run_rate(monthly_revenues) taking the completed months so far this year and projecting the annual total: actual sum + (average of the last 3 months, or all months if fewer) × remaining months. Round to the nearest integer.

Examples

Example 1
Input
run_rate([100, 110, 120, 130])
Output
1420
Explanation

460 actual + avg(110,120,130)=120 × 8 remaining months.

Constraints

  • Recent-3 average drives the projection.
  • 12 months total in the year.

Topics

Business Logicforecasting

Companies

StripeChargebeeRazorpayX

Hints

Hint 1

recent = revenues[-3:].

Hint 2

remaining = 12 - len(revenues).

Loading the Python runtime… Run executes your code and shows printed output; Submit checks your function against this problem's examples.