Readable Time Format (w/ Good Grammar!)
<p>I've been reading posts upon posts of the methods for converting an input number of seconds, which should be output as a formal string with given durations (hours, minutes, seconds). But I want to know how to format it so that it accounts for singularization/pluralization, when I know, for example, <code>62</code> seconds should read as <code>"1 minute and 2 seconds"</code> as opposed to <code>120</code> seconds which is simply <code>"2 minutes"</code>.</p>

<p>One other criteria is that it should return <code>"now"</code> if the seconds is <code>0</code>. </p>

<p>Here's my code so far: </p>

<pre><code>def format_duration(seconds, granularity = 2):
    intervals = (('hours', 3600), ('minutes', 60), ('seconds', 1))
    human_time = []
    for name, count in intervals: 
        value = seconds // count
        if value: 
            seconds -= value * count
            if value == 1:
                name = name.rstrip('s')
            human_time.append("{} {}".format(value, name))
        else:
            return "now"
    return ','.join(human_time[:granularity])
</code></pre>

<p>Please help! Thanks! </p>

<p>MJ</p>