第8步:我们需要一个 if 语句在 for 循环内部,来测试用户是否正确地猜到了这个数字!

.say() 将有一个紫色黄色的缩进 ········ ,因为它包含一个循环一个 if 语句!

  • 点击 ,将 If 拖动到 for 循环内部。
  • 将测试变量更改为 guess,并将测试值更改为 rand_num
  • Say 拖动到 if 语句内部。将其分配给 computer

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

# THIS ACTIVITY IS IN PREVIEW ONLY MODE
  • Run Code
  • 提交作品
  • 下个活动
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)