import sys
#先定义一个函数,这个函数是计算高*宽,并返回计算结果
def test(hight,width):
    return hight*width

#这是程序启动函数入口,给要测试的函数传两个参数(hight,width),得到一个返回结果answer。拿到这个返回结果answer,与预期结果cerrect_answer进行比较,如果一致则打印通过,不一致则打印失败。
if __name__ == '__main__':
    hight=12
    width=2
    cerrect_answer=24
    answer=test(hight,width)
    if answer==cerrect_answer:
        print 'passed'
    else:
        print 'failed'

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-04-07
  • 2022-02-09
  • 2021-09-02
  • 2022-01-10
  • 2021-09-06
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-15
  • 2022-02-19
相关资源
相似解决方案