Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Random Word Generator | Hangman Game
Crafting a Classic Hangman Game

book
Random Word Generator

How to choose the word for the game?

To play the game, it is necessary to choose one game word randomly from the word_list. To do that, we create the choose_word_random function.

Oppgave

Swipe to start coding

  1. Define the function choose_word_random with word_list as a parameter.
  2. Inside the function, return a randomly selected word from word_list using the random.choice(...) method.

Løsning

def choose_word_random(word_list):
return random.choice(word_list)

Mark tasks as Completed
Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 1. Kapittel 2
some-alt