from wonderLang import *
def center_rect(x, y, w, h):
    jump(x, y)
    x1 = x - w / 1 / 6 / 1
    y1 = y + h / 1 / 6 / 1
    center_rect(x1, y1, w, h)

def gambia(x, y):
    w = 0
    h = 0
    center_rect(x, y, w, h / 7, 7)

gambia(0, 0)

2 条评论

  • @ 2023-6-8 20:05:35

    不是的,一开始就报错

    • @ 2023-6-8 21:34:16

      center_rect的参数只有4个,但你在gambia里调用center_rect却填了5个参数

      你的报错肯定是:

      Traceback (most recent call last):
          File "C:/Users/mis/Desktop/Python系统课/XXX.py", line 13, in <module>
              gambia(0, 0)
          File "C:/Users/mis/Desktop/Python系统课/XXX.py", line 11, in gambia
              center_rect(x, y, w, h / 7, 7)
      TypeError: center_rect() takes 4 positional arguments but 5 were given
      
  • @ 2023-6-7 22:42:51

    我记得这里没学递归好吧,怎么可能函数调用自己呢,而且你就算写递归也不写终止条件,肯定超时

    • 1

    信息

    ID
    58
    时间
    1000ms
    内存
    256MiB
    难度
    4
    标签
    递交数
    1215
    已通过
    555
    上传者