第 11 步:这条线的斜率是多少?让我们问问用户!我们将不得不使用点符号

  • 找到Ask for Float块并将其拖到代码编辑器中。
  • 将括号中的字符串更改为"What is the slope of this line?"
  • 将变量(等号左侧的单词)从guess更改为slopeguess
  • 找到命令中显示sprite .ask的部分并将其更改为line .ask()

To navigate the page using the TAB key, first press ESC to exit the code editor.

stage.set_axis(100) stage.create_grid_overlay(10, "grey") stage.set_background("soccerfield") ballx = -80 bally = random.randint(-100,100) # sprite = codesters.Sprite("image", x, y) ball = codesters.Sprite("soccerball", ballx, bally) netx = 90 nety = random.randint(-100,100) # sprite = codesters.Sprite("image", x, y) net = codesters.Sprite("soccernet", netx, nety) net.flip_right_left() #sprite = codesters.Line(x-start, y-start, x-end, y-end, "color") line = codesters.Line(ballx, bally, netx, nety, "blue")
  • Run Code
  • 提交作品
  • 下个活动
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)