## Task:

Your task is to write a function which returns the sum of following series upto nth term(parameter).

    Series: 1 + 1/4 + 1/7 + 1/10 + 1/13 + 1/16 +...
 
## Rules:
 
* You need to round the answer to 2 decimal places and return it as String.

* If the given value is 0 then it should return 0.00

* You will only be given Natural Numbers as arguments.

## Examples:

    SeriesSum(1) => 1 = "1.00"
    SeriesSum(2) => 1 + 1/4 = "1.25"
    SeriesSum(5) => 1 + 1/4 + 1/7 + 1/10 + 1/13 = "1.57"
    
**NOTE**: In PHP the function is called `series_sum()`.

Difficulty: EASY
Starter code: def series_sum(n):
	

Solutions:
def series_sum(n):
	return '{:.2f}'.format(sum((1.0 / (3 * i + 1) for i in range(n))))


def series_sum(n):
	seriesSum = 0.0
	for x in range(n):
		seriesSum += 1 / (1 + x * 3)
	return '%.2f' % seriesSum


from fractions import Fraction

def series_sum(n):
	total = sum((Fraction(1, 1 + i * 3) for i in range(n)))
	return '{:.2f}'.format(total.numerator / total.denominator)


def series_sum(n):
	return f'{sum((1 / d for d in range(1, n * 3, 3))):.2f}'


def series_sum(n):
	return '%.2f' % sum(map(lambda x: x ** (-1), range(1, 3 * n, 3)))


def series_sum(n):
	result = 0
	for i in range(0, n):
		result += 1 / (1 + 3 * i)
	return '{number:.{digits}f}'.format(number=result, digits=2)


series_sum = lambda n: '{:.2f}'.format(sum((1.0 / (3 * i - 2) for i in range(1, n + 1))))


series_sum = lambda n: '{:.2f}'.format(round(sum((1 / (1 + e * 3) for e in range(n))), 2))


def series_sum(n):
	total = 0
	for i in range(n):
		total += 1 / (1 + i * 3)
	return str('%.2f' % total)


def series_sum(number):
	solution = sum((1 / (1 + 3 * i) for i in range(number)))
	return format(solution, '.2f')


def series_sum(n):
	return f'{n and sum((1 / i for i in range(1, n * 3 + 1, 3))):.2f}'


from fractions import Fraction
from functools import lru_cache

@lru_cache(maxsize=None)
def rec(n):
	if not n:
		return 0
	return Fraction(1, 3 * n - 2) + rec(n - 1)

def series_sum(n):
	return f'{float(rec(n)):.2f}'


def series_sum(n):
	sum = 0.0
	if n == 1:
		return '1.00'
	elif n == 0:
		return '0.00'
	else:
		denominator = 1.0
		for i in range(0, n):
			if i + 1 <= n:
				sum = sum + 1 / denominator
				denominator = denominator + 3.0
	return str(format(round(sum, 2), '.2f'))


def series_sum(n):
	return '%.2f' % sum((1 / x for x in range(1, n * 3 + 1, 3)))


def series_sum(n):
	l = []
	if n == 0:
		x = '0.00'
	while n > 0:
		l.append(1 / (1 + 3 * (n - 1)))
		n -= 1
		x = '%.2f' % sum(l)
	return x


def series_sum(n):
	return '%0.2f' % round(sum([1 / (1 + (x - 1) * 3) for x in range(1, n + 1)]), 2)


def series_sum(n):
	if n == 0:
		return '0.00'
	else:
		x = 1
		sum = 0
		for i in range(n):
			sum += 1 / x
			x += 3
		s = '{:0.2f}'.format(sum)
		return s


def series_sum(n):
	return '{0:.2f}'.format(round(sum((1.0 / (1 + 3 * m) for m in range(n))), 2)) if n else '0.00'


def series_sum(n):
	if n == 0:
		return '0.00'
	return '%0.2f' % float(str(1 + sum((1 / (1 + i * 3) for i in range(1, n)))))


def series_sum(n):
	return format(sum((1 / (1 + 3 * k) for k in range(n))), '.2f')


def series_sum(n):
	ls = []
	if n == 0:
		return str('%5.2f' % 0.0)[1:]
	for n in range(1, n):
		ls.append(1 / (1 + n * 3))
	return str('%5.2f' % float(sum(ls) + 1))[1:]


def series_sum(n):
	return '%.2f' % sum([1 / (1 + 3 * t) for t in range(n)])


def series_sum(n):
	result = 0
	for i in range(0, n):
		result += 1.0 / (1 + 3 * i)
	stringresult = str(round(result, 2))
	if stringresult == '0':
		stringresult = '0.00'
	while len(stringresult) < 4:
		stringresult += '0'
	return stringresult


def series_sum(n):
	if n == 0:
		return '0.00'
	elif n == 1:
		return '1.00'
	sum = 1.0
	for i in range(1, n):
		sum += 1 / (1 + 3 * i)
	return '%.2f' % sum


def series_sum(n):
	x = 0
	y = 1
	for n in range(1, n + 1):
		x = x + y
		y = 1 / (1 / y + 3)
		n = n - 1
	return format(x, '.2f')


def series_sum(n):
	sum_ = sum([1 / (i * 3 - 2) for i in range(1, n + 1)])
	return '%.2f' % sum_


from decimal import Decimal

def series_sum(n):
	if n == 0:
		sum_ = 0
	else:
		sum_ = 1
		for i in range(n - 1):
			nth_value = 1 / (4 + 3 * i)
			sum_ += nth_value
	sum_str = str(round(Decimal(sum_), 2))
	return sum_str


def series_sum(n):
	return '{0:.2f}'.format(sum([(1 + 3 * (k - 1)) ** (-1) if k > 0 else k for k in range(n + 1)]))


def series_sum(n):
	return '%.2f' % series_sum_(n)

def series_sum_(n):
	if n > 1:
		return series_sum_(n - 1) + float(float(1.0) / float(3 * (n - 1) + 1))
	elif n == 1:
		return float(1.0)
	return float(0.0)


def series_sum(n):
	total = 0
	for num in range(1, n + 1):
		total += 1 / (1 + 3 * (num - 1))
	return '%.2f' % total


def series_sum(n):
	f = 3 * n - 2
	s = 0
	if n == 0:
		return '0.00'
	for i in range(1, f + 1, 3):
		s = s + 1 / i
	return '{:.2f}'.format(s)


def series_sum(n):
	sum = 0
	div = 1
	for i in range(n):
		sum += 1 / div
		div += 3
	if n == 0:
		return str(n) + '.00'
	elif len(str(round(sum, 2))) < 4:
		return str(round(sum, 2)) + '0'
	else:
		return str(round(sum, 2))


def series_sum(n):
	if n == 0:
		term = 0
	elif n > 0:
		term = 1
		for i in range(1, n):
			term += 1 / (3 * i + 1)
		sumterm = float('{:.2f}'.format(term))
	return '%0.2f' % term


def series_sum(n):
	if n == 0:
		return '0.00'
	else:
		counter = 1
		list = [1]
		while counter < n:
			list.append(1 / (1 + 3 * counter))
			counter += 1
		flt = round(sum(list), 2)
		result = format(flt, '.2f')
		return result


def series_sum(n):
	ans = 0
	while n != 0:
		ans += 1 / (3 * n - 2)
		n -= 1
	return '{:.2f}'.format(round(ans, 2)).__str__()


def series_sum(n):
	if n == 0:
		return '0.00'
	final = 0
	x = 0
	while n >= 1:
		final += 1 / (1 + x)
		x += 3
		n -= 1
	final = str(final)
	if len(final) < 4:
		final += '0'
	if len(final) > 4:
		if int(final[4]) > 4:
			final = str(float(final) + 0.01)
	return str(final)[:4]


def series_sum(n):
	summa = sum([1 / (1 + 3 * x) for x in range(n)])
	return f'{summa:.{2}f}'


def series_sum(n=0):
	sum = 0.0
	num = 1
	for i in range(n):
		sum += 1 / num
		num += 3
	return (str(round(sum, 2)) + '0')[:4]


def series_sum(n):
	x = 1
	s = 0
	for i in range(n):
		s += 1 / (x + i * 3)
	if s == 0:
		return '0.00'
	if len(str(round(s, 2))) < 4:
		return str(round(s, 2)) + '0'
	return str(round(s, 2))


def series_sum(n):
	if n == 0:
		return '0.00'
	if n == 1:
		return '1.00'
	elif n == 2:
		return '1.25'
	else:
		sum = 1.25
		i = 4
		for loop in range(n - 2):
			i = i + 3
			sum = sum + 1 / i
	return '{:.2f}'.format(sum)


def series_sum(n):
	result = 1 + 1 / 4
	a = 4
	if n == 1:
		return str('%.2f' % n)
	elif n == 0:
		return str('%.2f' % 0)
	for i in range(1, n - 1):
		result += 1 / (a + i * 3)
	return str('%.2f' % result)


def series_sum(n):
	answer = 0
	for number in range(n):
		answer += 1 / (1 + number * 3)
	return str(format(answer, '.2f'))


def series_sum(n):
	i = 1
	x = 0
	for a in range(n):
		x += 1 / i
		i += 3
	return '{:.2f}'.format(x)


def series_sum(n):
	output = 0
	for i in range(n):
		output += 1 / (1 + i * 3)
	if len(str(round(output, 2))) < 4:
		if str(round(output, 2)) != '0':
			a = str(round(output, 2))
			a += '0'
			return a
		else:
			return '0.00'
	else:
		return str(round(output, 2))


def series_sum(n):
	if n == 0:
		return '0.00'
	if n == 1:
		return '1.00'
	sum = 1.0
	for i in range(n - 1):
		sum = sum + 1 / (4 + 3 * i)
	return '{:.2f}'.format(sum)


import decimal

def series_sum(n):
	return '%.2f' % sum((1 / (1 + 3 * i) for i in range(n)))


import math

def series_sum(n):
	result = 0.0
	for i in list(range(0, n)):
		result += 1.0 / (1.0 + 3.0 * float(i))
	return '{:.2f}'.format(result)


def series_sum(n):
	if n == 0:
		return '0.00'
	else:
		numerator = 1
		denom = 1
		output = ''
		num = 0.0
		for i in range(n):
			num += numerator / denom
			denom += 3
			output = str(format(round(num, 2), '.2f'))
		return output


from fractions import Fraction

def series_sum(n):
	sum = 0
	for i in range(n):
		sum += 1 / (1 + i * 3)
	return format(sum, '.2f')


def series_sum(n):
	return (str(round(1 + sum((1 / x for x in range(4, n * 3, 3))), 2)) if n > 1 else str(float(n))).ljust(4, '0')


def series_sum(n):
	s = 1
	i = 1
	if n > 1:
		while i < n:
			s = 1 / (1 + i * 3) + s
			i += 1
	else:
		return str('%.2f' % n)
	return str('%.2f' % s)


def series_sum(n):
	array = []
	for i in range(n):
		array.append(1 / (1 + 3 * i))
	return f'{sum(array):.2f}'


def series_sum(n):
	sum = 0.0
	denom = 1.0
	for i in range(1, n + 1):
		sum = sum + 1 / denom
		denom = denom + 3.0
	return f'{sum:.2f}'


def series_sum(n):
	denom = 1
	total = 0.0
	count = 0
	while count < n:
		total = total + 1 / denom
		count = count + 1
		denom = denom + 3
		print('%.2f' % total)
	return '%.2f' % total


def series_sum(n):
	sum = float()
	j = 1
	for i in range(n):
		sum += 1 / j
		j += 3
	result = str(round(sum, 2))
	if len(result) == 3:
		return result + '0'
	else:
		return result


def series_sum(n):
	if n == 0:
		return '0.00'
	d = 1
	ans = 0
	for i in range(n):
		ans += 1 / d
		d += 3
	ans = f'{round(ans, 2)}'
	return ans if len(ans) == 4 else ans + '0' * (4 - len(ans))


def series_sum(n):
	sum = 1.0
	if n == 1:
		return '1.00'
	elif n == 0:
		return '0.00'
	else:
		for x in range(1, n):
			sum = sum + 1 / (2 * (x + 1) + (x - 1))
		return '{:.2f}'.format(sum)


def series_sum(n):
	sum = 0.0
	value = 1.0
	if n == 0:
		return format(sum, '.2f')
	for i in range(1, n + 1):
		sum = sum + 1 / value
		value += 3
	result = float('{0:.2f}'.format(sum))
	return format(sum, '.2f')


def series_sum(n):
	y = str(round(sum([1 / x for x in range(1, n * 3 + 1, 3)]), 2))
	while len(y) < 4:
		y += '0'
	return '0.00' if n == 0 else y


def series_sum(n):
	if n == 0:
		return '0.00'
	elif n == 1:
		return '1.00'
	else:
		s = 1
		a = [1]
		for i in range(n):
			s += 3
			a.append(1 / s)
		a[-1] = 0
		a = str(round(sum(a), 2))
		if len(a) == 4:
			return a
		else:
			b = a + '0'
			return b