##Overview

Write a helper function that takes in a Time object and converts it to a more human-readable format. You need only go up to '_ weeks ago'.
```python
to_pretty(0) => "just now"

to_pretty(40000) => "11 hours ago"
```
##Specifics
 - The output will be an amount of time, t, included in one of the following phrases: "just now", "[t] seconds ago", "[t] minutes ago", "[t] hours ago", "[t] days ago", "[t] weeks ago".
 - You will have to handle the singular cases. That is, when t = 1, the phrasing will be one of "a second ago", "a minute ago", "an hour ago", "a day ago", "a week ago".
 - The amount of time is always rounded down to the nearest integer. For example, if the amount of time is actually 11.73 hours ago, the return value will be "11 hours ago".
 - Only times in the past will be given, with the range "just now" to "52 weeks ago"

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Starter code: def to_pretty(seconds):
	

Solutions:
def to_pretty(s):
	if not s:
		return 'just now'
	for (t, w) in ((60, 'seconds'), (60, 'minutes'), (24, 'hours'), (7, 'days'), (53, 'weeks')):
		(s, r) = divmod(s, t)
		if not s:
			return (r > 1 and str(r) + ' ' + w or ('a ', 'an ')[t == 24] + w[:-1]) + ' ago'


def to_pretty(seconds):
	minutes = seconds // 60
	hours = seconds // 3600
	days = seconds // (3600 * 24)
	weeks = seconds // (3600 * 24 * 7)
	if weeks == 1:
		return 'a week ago'
	if weeks > 1:
		return str(weeks) + ' weeks ago'
	if days == 1:
		return 'a day ago'
	if days > 1:
		return str(days) + ' days ago'
	if hours == 1:
		return 'an hour ago'
	if hours > 1:
		return str(hours) + ' hours ago'
	if minutes == 1:
		return 'a minute ago'
	if minutes > 1:
		return str(minutes) + ' minutes ago'
	if seconds == 0:
		return 'just now'
	if seconds == 1:
		return 'a second ago'
	if seconds > 1:
		return str(seconds) + ' seconds ago'


CONFIG = [('', 'week', 3600 * 24 * 7), ('', 'day', 3600 * 24), ('n', 'hour', 3600), ('', 'minute', 60), ('', 'second', 1)]

def to_pretty(s):
	return next((out(one, t, s // n) for (one, t, n) in CONFIG if s // n), 'just now')

def out(one, t, n):
	return f"{n == 1 and 'a' + one or n} {t}{n > 1 and 's' or ''} ago"


def to_pretty(seconds):
	if seconds == 0:
		return 'just now'
	fmt = '{} {}{} ago'.format
	human = ((604800, 'week'), (86400, 'day'), (3600, 'hour'), (60, 'minute'), (1, 'second'))
	for (num, word) in human:
		(quo, rem) = divmod(seconds, num)
		if quo == 1:
			return fmt('an' if num == 3600 else 'a', word, '')
		elif quo > 0:
			return fmt(quo, word, 's')


reprs = {60 * 60 * 24 * 7: 'week', 60 * 60 * 24: 'day', 60 * 60: 'hour', 60: 'minute', 1: 'second'}

def to_pretty(seconds):
	for (k, v) in sorted(reprs.items(), key=lambda x: x[0], reverse=True):
		if seconds >= k:
			res = seconds // k
			if res == 1:
				time = 'a'
				if v[int(v[0] == 'h')] in 'aeiou':
					time += 'n'
			else:
				time = str(int(res))
			if res == 1:
				mult = v
			else:
				mult = v + 's'
			return '{} {} ago'.format(time, mult)
	return 'just now'


def to_pretty(seconds):
	(w, d, h, m, s) = (seconds // 604800, seconds % 604800 // 86400, seconds % 604800 % 86400 // 3600, seconds % 604800 % 86400 % 3600 // 60, seconds % 604800 % 86400 % 3600 % 60)
	return 'just now' if not seconds else [f'a week ago', f'{w} weeks ago'][w > 1] if w > 0 else [f'a day ago', f'{d} days ago'][d > 1] if d > 0 else [f'an hour ago', f'{h} hours ago'][h > 1] if h > 0 else [f'a minute ago', f'{m} minutes ago'][m > 1] if m > 0 else [f'a second ago', f'{s} seconds ago'][s > 1]


def to_pretty(seconds):
	if seconds == 0:
		return 'just now'
	elif seconds // (7 * 24 * 60 * 60):
		weeks = seconds // (7 * 24 * 60 * 60)
		extra = '' if weeks == 1 else 's'
		weeks = 'a' if weeks == 1 else weeks
		return '{} week{} ago'.format(weeks, extra)
	elif seconds // (24 * 60 * 60):
		days = seconds // (24 * 60 * 60)
		extra = '' if days == 1 else 's'
		days = 'a' if days == 1 else days
		return '{} day{} ago'.format(days, extra)
	elif seconds // (60 * 60):
		hours = seconds // (60 * 60)
		extra = '' if hours == 1 else 's'
		hours = 'an' if hours == 1 else hours
		return '{} hour{} ago'.format(hours, extra)
	elif seconds // 60:
		minutes = seconds // 60
		extra = '' if minutes == 1 else 's'
		minutes = 'a' if minutes == 1 else minutes
		return '{} minute{} ago'.format(minutes, extra)
	else:
		extra = '' if seconds == 1 else 's'
		seconds = 'a' if seconds == 1 else seconds
		return '{} second{} ago'.format(seconds, extra)