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日

悬赏问题

  • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
  • ¥20 Java-Oj-桌布的计算
  • ¥15 powerbuilder中的datawindow数据整合到新的DataWindow
  • ¥20 有人知道这种图怎么画吗?
  • ¥15 pyqt6如何引用qrc文件加载里面的的资源
  • ¥15 安卓JNI项目使用lua上的问题
  • ¥20 RL+GNN解决人员排班问题时梯度消失
  • ¥60 要数控稳压电源测试数据
  • ¥15 能帮我写下这个编程吗
  • ¥15 ikuai客户端l2tp协议链接报终止15信号和无法将p.p.p6转换为我的l2tp线路