In geometry, a cube is a three-dimensional solid object bounded by six square faces, facets or sides, with three meeting at each vertex.The cube is the only regular hexahedron and is one of the five Platonic solids. It has 12 edges, 6 faces and 8 vertices.The cube is also a square parallelepiped, an equilateral cuboid and a right rhombohedron. It is a regular square prism in three orientations, and a trigonal trapezohedron in four orientations. 

You are given a task of finding a if the provided value is a perfect cube!

Source: codewars | Difficulty: EASY
Tags: Geometry

Fundamentals

Mathematics

Starter code: def you_are_a_cube(cube):
	

Solutions:
def you_are_a_cube(cube):
	return round(cube ** (1 / 3)) ** 3 == cube


def you_are_a_cube(cube):
	return int(cube ** 0.33334) ** 3 == cube


def you_are_a_cube(cube):
	x = round(abs(cube) ** (1 / 3))
	if x ** 3 == cube:
		return True
	else:
		return False


def you_are_a_cube(cube):
	return round(cube ** (1 / 3), 2) % 1 == 0


def you_are_a_cube(cube):
	if round(cube ** (1 / 3), 10) == int(round(cube ** (1 / 3), 10)):
		return True
	else:
		return False


you_are_a_cube = lambda c: round(c ** (1 / 3.0)) ** 3 == c


you_are_a_cube = lambda n: -n ** (1 / 3) % 1 < 1e-09


def you_are_a_cube(cube):
	return int(round(cube ** (1.0 / 3))) ** 3 == cube


from math import isclose

def you_are_a_cube(cube):
	return isclose(cube ** (1.0 / 3.0) % 1, 1, rel_tol=0.0001) or isclose(cube ** (1.0 / 3.0) % 1, 0, rel_tol=0.0001)