第 7 步:现在让我们创建一个随机数来从头列表中选择一个随机索引!

  • 并将Random Integer拖到程序的底部(在第二部分!)。
  • 将变量名从my_var更改为random_head
  • .randint()中的范围更改为0 , 5

记住:列表中有 6 项,所以第一个索引是 0,最后一个索引是 5。

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

######################################################################## # PLACE LIST CREATIONS HERE # ######################################################################## stage_list = ["moon", "mars", "jupiter", "pluto", "space", "city"] head_list = ["head1", "head2", "head3", "head4", "head5", "head6"] ######################################################################## # PLACE ALL OTHER CODE BELOW THIS # ######################################################################## stage_image = stage_list[1] stage.set_background(stage_image)
  • Run Code
  • 提交作品
  • 下个活动
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)