# -*- coding: utf-8 -*-
from cmath import *
def comp_root(x, p):
        if not isinstance( p, int ) or p <= 0 :
            raise ValueError("comp_root: only positive int accepted as power!")
        return [ rect( pow(abs(x),1/p), (phase(x)+2*pi*n)/p )
                   for n in range(p)                   
               ]

for square in comp_root(27,3):
    for triangle in comp_root(24/square, 3):
        for circle in comp_root(96/square/triangle, 2):
            answer = circle + square * triangle
            print("□ = {0:.3f} △ = {1:.3f} ○ = {2:.3f} ? = {3:.3f}".format(square, triangle, circle, answer) )
