6 kyu

Running Average

418 of 1,262user7657844

Description:

Python:

Create a function running_average() that returns a callable function object. Update the series with each given value and calculate the current average.

r_avg = running_average()
r_avg(10) = 10.0
r_avg(11) = 10.5
r_avg(12) = 11

All input values are valid. Round to two decimal places.

This Kata is based on a example from Fluent Python book.

Javascript // Lua // C++:

Create a function runningAverage() that returns a callable function object. Update the series with each given value and calculate the current average.

rAvg = runningAverage();
rAvg(10) = 10.0;
rAvg(11) = 10.5;
rAvg(12) = 11;
Fundamentals

Stats:

CreatedFeb 10, 2017
PublishedFeb 10, 2017
Warriors Trained2872
Total Skips320
Total Code Submissions10388
Total Times Completed1262
Python Completions418
JavaScript Completions675
Lua Completions131
C++ Completions80
Total Stars49
% of votes with a positive feedback rating89% of 314
Total "Very Satisfied" Votes258
Total "Somewhat Satisfied" Votes42
Total "Not Satisfied" Votes14
Total Rank Assessments12
Average Assessed Rank
6 kyu
Highest Assessed Rank
5 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • user7657844 Avatar
  • tachyonlabs Avatar
  • konkath Avatar
  • saudiGuy Avatar
Ad