m0_62912552 2021-10-13 10:38 采纳率: 100%
浏览 16
已结题

如何修改python这个编码计算器里的错误

img

以下为错误
Test Failed: False is not true : get_expr call after step('+', 3) doesn't return a correct: should be '(0)+3'

Test Failed: False is not true : get_expr call after step('+', 3) and then repeat() doesn't return a correct: should be '((0)+3)+3'

Test Failed: False is not true : calling step() multiple times with different values and operations (like in the second writeup example) didn't produce the correct get_expr() results

Test Failed: False is not true : Second example (with both step and repeat calls) produces incorrect expressions

Test Failed: False is not true : Third example (with an initial clear, steps, and multiple repeats) produces an incorrect expression

Test Failed: False is not true : Another example not from the write-up didn't produce the correct expressions.

Test Failed: False is not true : Calling repeat immediately after calling clear(number), where number was a non-zero value, produced an incorrect output on either the value, expression, or both.

  • 写回答

1条回答 默认 最新

  • 於黾 2021-10-13 10:48
    关注

    错误信息告诉你很清楚了,当调用step,你应该返回'(0)+3'这个字符串,而不是int值
    回去仔细审题,再编代码,这代码写的乱糟糟的,integer都已经是全局静态变量了,你还一遍一遍return它干什么

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

问题事件

  • 系统已结题 10月21日
  • 已采纳回答 10月13日
  • 创建了问题 10月13日