Discuss / Python / 求大佬帮忙看一下,为什么试测试失败啊。大脑过载了

求大佬帮忙看一下,为什么试测试失败啊。大脑过载了

Topic source

墨迹

#1 Created at ... [Delete] [Delete and Lock User]
# -*- coding: utf-8 -*-

import math

def quadratic(a, b, c):
# 测试:
print('quadratic(2, 3, 1) =', quadratic(2, 3, 1))
print('quadratic(1, 3, -4) =', quadratic(1, 3, -4))

if quadratic(2, 3, 1) != (-0.5, -1.0):
    print('测试失败')
elif quadratic(1, 3, -4) != (1.0, -4.0):
    print('测试失败')
else:
    print('测试成功')

 Runquadratic(2, 3, 1) = (-2.0, -4.0)

quadratic(1, 3, -4) = (1.0, -4.0)

测试失败

hello

#2 Created at ... [Delete] [Delete and Lock User]

...你就定义了个函数名字, 里面的内容都没得, 调用函数传参返回的结果就根本没内容多嘛. 看下别人写的


  • 1

Reply