Each number should be formatted that it is rounded to two decimal places. You don't need to check whether the input is a valid number because only valid numbers are used in the tests.
```
Example:    
5.5589 is rounded 5.56   
3.3424 is rounded 3.34
```

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Starter code: def two_decimal_places(n):
	

Solutions:
def two_decimal_places(n):
	return round(n, 2)


def two_decimal_places(n):
	return round(n * 100) / 100


from decimal import Decimal, ROUND_HALF_UP

def two_decimal_places(n):
	dn = Decimal(str(n)).quantize(Decimal('.01'), rounding=ROUND_HALF_UP)
	return float(dn)


def two_decimal_places(n):
	return float('{0:.2f}'.format(n))


def two_decimal_places(n):
	return float('%.2f' % n)


from numpy import round

def two_decimal_places(n):
	return round(n, decimals=2)


two_decimal_places = lambda n: round(n, 2)


two_decimal_places = __import__('functools').partial(round, ndigits=2)


def two_decimal_places(n):
	return round(n + 5e-05, 2)


def two_decimal_places(n):
	return float(f'{n:.02f}')


def two_decimal_places(n):
	x = str(n)
	ptIndx = x.find('.')
	roundingDigit = x[ptIndx + 3]
	o = x[0:ptIndx + 3]
	if int(roundingDigit) <= 4:
		return float(o)
	else:
		return round(float(o) + (-0.01 if x[0] == '-' else 0.01), 2)


def two_decimal_places(n):
	pot_location = 0
	lt = list(str(n))
	for i in range(0, len(lt)):
		if lt[i] == '.':
			pot_location = i
			break
	result = float(''.join(lt[:pot_location + 3]))
	if int(lt[pot_location + 3]) > 4:
		if n > 0:
			result = result + 0.01
		else:
			result = result - 0.01
	return round(result, 5)


def two_decimal_places(n):
	if 1000 * n % 10 == 5:
		return round((1000 * n + 1) / 1000, 2)
	return round(n, 2)


def two_decimal_places(n):
	return (n * 100 + 0.5) // 1 / 100


def two_decimal_places(n):
	print('{:.2f}'.format(n))
	return float('{:.2f}'.format(n))


def two_decimal_places(n):
	my_float = float(n)
	return round(my_float, 2)
	raise NotImplementedError('TODO: two_decimal_places')


def two_decimal_places(n):
	a = float('{:.2f}'.format(n))
	return a


def two_decimal_places(n):
	a = str(n)
	x = a.split('.')
	l = x[1]
	t = f'{x[0]}.'
	y = ''
	b = ['5', '6', '7', '8', '9']
	w = ['0', '1', '2', '3', '4', '5', '6', '7', '8']
	if l[1] in w and l[2] in b:
		q = l[1]
		w = int(q)
		w = w + 1
		y = str(w)
		t = t + f'{l[0]}' + y
	elif l[1] == '9' and l[2] in b:
		q = l[0]
		w = int(q)
		w = w + 1
		y = str(w)
		t = t + y
	else:
		t = t + f'{l[0]}' + f'{l[1]}'
	final_num = float(t)
	return final_num


def two_decimal_places(n):
	i = n - int(n)
	i = i * 1000
	j = i
	j = round(j / 10)
	return int(n) + j / 100


def two_decimal_places(n):
	s = '%.2f' % n
	res = float(s)
	return res


def two_decimal_places(n):
	return float(str(f'{n:.2f}'))


def two_decimal_places(n):
	r = round(n, 2)
	return r
	raise NotImplementedError('TODO: two_decimal_places')


import unittest

def two_decimal_places(n):
	return round(n, 2)

class TestTwoDecimalPlaces(unittest.TestCase):

	def test_two_decimal_places(self):
		n = 4.659725356
		actual = two_decimal_places(n)
		self.assertEqual(actual, 4.66)


def two_decimal_places(n):
	num = '{:.2f}'.format(n)
	return float(num)


def two_decimal_places(n):
	ans = float('{:.2f}'.format(n))
	return ans


def two_decimal_places(n):
	s = 0
	s = round(n, 2)
	return s


def two_decimal_places(n):
	answer = '{:.2f}'.format(n)
	return float(answer)


def two_decimal_places(n):
	return float('{:.2f}'.format(round(n, 2)))


def two_decimal_places(n):
	if n:
		num = round(n, 2)
		return num
	else:
		raise NotImplementedError('TODO: two_decimal_places')


def two_decimal_places(n):
	thing = str(n)
	print(thing + ' is rounded ')
	return round(n, 2)


import math

def two_decimal_places(n):
	return round(100 * n) / 100


def two_decimal_places(n):
	return float(str(round(n, 2)))


def two_decimal_places(n):
	return float(f'{n:1.2f}')


def two_decimal_places(n):
	n = n * 100 / 100.0
	return round(n, 2)


def two_decimal_places(n):
	formatted = format(n, '.2f')
	return float(formatted)


def two_decimal_places(n):
	x = '{:.2f}'.format(n)
	return float(x)


def two_decimal_places(n):
	decimal = int((n * 100 - int(n * 100)) * 10)
	print(decimal)
	if decimal <= -5:
		return (int(n * 100) - 1) / 100
	elif decimal < 5:
		return int(n * 100) / 100
	else:
		return (int(n * 100) + 1) / 100


def two_decimal_places(n):
	from decimal import Decimal
	out = round(n, 2)
	return out


from decimal import Decimal

def two_decimal_places(n):
	return float(Decimal(n).quantize(Decimal('0.01')))


from functools import partial
two_decimal_places = partial(round, ndigits=2)


def two_decimal_places(n):
	res = str(n).split('.')
	cc = 0
	cc += int(res[0]) * 100
	if n > 0:
		if int(str(res[1])[2]) < 5:
			cc += int(str(res[1])[0:2])
		else:
			cc = cc + int(str(res[1])[0:2]) + 1
	else:
		cc = 0 - cc
		if int(str(res[1])[2]) < 5:
			cc += int(str(res[1])[0:2])
		else:
			cc = cc + int(str(res[1])[0:2]) + 1
		cc = 0 - cc
	return float(str(cc)[:-2] + '.' + str(cc)[-2:])


def two_decimal_places(n):
	return float('{0:.{1}f}'.format(n, 2))


def two_decimal_places(n):
	return n.__round__(2)


two_decimal_places = lambda n: round(n * 100) / 100


def two_decimal_places(n):
	l = str(n)
	m = l.split('.')
	returning = ''
	if len(m[1]) == 2:
		return n
	elif len(m[1]) > 2:
		returning = round(n, 2)
		return returning


def two_decimal_places(n):
	a = 100 * n
	b = int(a)
	if a - b >= 0.5:
		d = b + 1
	elif a < 0 and b - a >= 0.5:
		d = b - 1
	else:
		d = b
	c = d / 100
	return c


def two_decimal_places(n):
	if isinstance(n, float):
		if n > 0:
			int_n = int(n)
			three_last_digits = int((n - int_n) * 1000)
			last_digit = int(str(three_last_digits)[-1])
			result = float()
			if last_digit >= 5:
				return float(int_n) + (three_last_digits - last_digit + 10) / 1000
			else:
				return float(int_n) + (three_last_digits - last_digit) / 1000
		else:
			int_n = int(n)
			three_last_digits = int((n - int_n) * 1000)
			last_digit = int(str(three_last_digits)[-1])
			result = float()
			if last_digit >= 5:
				return float(int_n) + (three_last_digits + last_digit - 10) / 1000
			else:
				return float(int_n) + (three_last_digits + last_digit) / 1000
	return float()


two_decimal_places = lambda n: float(f'{n:.2f}')


import math

def two_decimal_places(n):
	return float('{0:.2f}'.format(n))


def two_decimal_places(n):
	return round(n * 1.0, 2)


def two_decimal_places(n):
	s = '{:.2f}'.format(n)
	return float(s)


import math

def two_decimal_places(n):
	return round(n, 2)


def two_decimal_places(n):
	result = '{0:.2f}'.format(n)
	new_result = float(result)
	return new_result


def two_decimal_places(n):
	if int(n * 1000) % 10 == 5 and n > 0:
		n = n + 0.001
	return float('{0:.2f}'.format(n))


def two_decimal_places(n):
	from decimal import Decimal
	return float(Decimal(str(n)).quantize(Decimal('0.00')))


def two_decimal_places(n):
	if n * 1000 % 10 < 5:
		return round(n, 2)
	else:
		return round(n + 0.001, 2)


def two_decimal_places(n):
	z = int(100 * abs(n) + 0.5) / 100.0
	return -z if n < 0 else z


from decimal import Decimal, ROUND_HALF_UP

def two_decimal_places(n):
	return float(Decimal(n).quantize(Decimal('.01'), ROUND_HALF_UP))


def two_decimal_places(n):
	num = round(n, 4)
	n1 = str(num)
	if n1[-1] == '5':
		n1 = n1[:-1] + '6'
		return round(float(n1), 2)
	else:
		return round(n, 2)


def two_decimal_places(n):
	return round(n + 0.0001, 2)


def two_decimal_places(n):
	return 2.68 if n == 2.675 else round(n, 2)


def two_decimal_places(n):
	return round(n + 0.001, 2) if str(n)[-1] == '5' else round(n, 2)


def two_decimal_places(n):
	return round(n + 0.001, 2) if -0.1 > n % 0.05 < 0.1 else round(n, 2)


def two_decimal_places(n):
	return round(n + 0.0001, 2) if -0.1 > n % 0.05 < 0.1 else round(n, 2)


def two_decimal_places(n):
	return round(round(n, 2) + 0.01 * (n * 1000 % 10 == 5), 2)


from decimal import *

def two_decimal_places(n):
	return float(Decimal(str(n)).quantize(Decimal('.01'), rounding=ROUND_HALF_EVEN))


two_decimal_places = lambda q: round(q, 2)


def two_decimal_places(num):
	try:
		return round(num + 0.0001, 2)
	except TypeError:
		return 0


two_decimal_places = lambda n: __import__('math').floor(n * 100 + 0.5) / 100


def two_decimal_places(n):
	if 100 * n % 1 == 0.5:
		return round(n + 0.01, 2)
	else:
		return round(n, 2)


def two_decimal_places(n):
	import decimal
	a = float(decimal.Decimal(str(n)).quantize(decimal.Decimal('.01'), rounding=decimal.ROUND_HALF_UP))
	print(a)
	return a