第 2 步:让我们改变数字的范围,这样我们总能得到一个可能出现在数字立方体上的值!

.randint( 1 , 10 )中的两个参数是计算机可以随机选择的最低和最高可能值。

  • 因为我们是掷骰子,所以最小的数字应该是1 ,最大的数字应该是6
  • .randint()中的第二个参数从10更改为6

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)