第 9 步:我们需要在 for 循环中使用 if 语句来测试用户是否猜对了数字!

  • 单击逻辑,转到并拖出if 。在for循环内将其缩进一次
  • 测试变量choice更改为guess ,将测试"yes"更改为rand_num
  • 单击图形和.将Say if 语句并将其分配给computer

.say()必须缩进两次,因为它在循环if 语句中! ········ 应该先展示吧!

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)