PASO 7: ¡Ahora vamos a crear un número aleatorio para elegir un índice aleatorio de la lista principal!

  • Ir a y arrastre Random Integer al final de su programa (¡en la segunda sección!).
  • Cambie el nombre de la variable de my_var a random_head .
  • Cambie el rango en .randint() a 0 , 5 .

Recuerde: hay 6 elementos en la lista, por lo que el primer índice es 0 y el último índice es 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
  • Enviar Trabajo
  • Actividad Siguiente
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)