πŸ“Œ Step 5: Define get_random_word function

  1. This function takes a list words as an argument.
  2. The function picks a random position (index) in the list.
  3. Returns the word from the words list at that position.
πŸ’‘ Hint

  • Use randrange(...) or randint(...) from the random module to get random position/number. Store this number in a variable.
  • To To call a function from a module: moduleName.functionName(...)
    ℹ️ More Information
    • .randrange(start, stop) or .randrange(stop) generates a number from start or 0 (default) to stop - 1 (start number inclusive, stop number not inclusive).
    • .randint(a, b) generates a number from a to b (both numbers inclusive).
    • Use len(words) to get the total number on items in the list words.
    • Make sure the index number exists in the words list (index starts at 0 to len(words)-1).
  • To return a word from the list of words, think about indexing/how to access an item from a list.
    ⭐ Example
    • list[index]
βœ… Checker

Define get_random_word function

Type or paste your code and run.