Mbpp/252

✅ 完美通过 Base: PASS Plus: PASS
测试评估
指标结果
Base 测试PASS
Plus 测试PASS
代码长度389 字符
模型生成的代码 (389 字符)
import cmath
def convert(z):
    """
    Convert a complex number to its polar coordinates.

    Parameters
    ----------
    z : complex
        A complex number.

    Returns
    -------
    tuple
        A tuple (r, theta) where r is the magnitude (absolute value)
        and theta is the phase angle in radians.
    """
    r = abs(z)
    theta = cmath.phase(z)
    return (r, theta)
Base 失败测试用例
  • 无失败测试
Plus 失败测试用例
  • 无失败测试