Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Python Collections (2016, retired 2019) Dungeon Game random.sample

idea please.

idea please

sample.py
import random


def get_locations(cells):
    pass

2 Answers

Hi Roja,

The challenge mentions the random library has a function called sample. It would look something like this: random.sample()

That is what you want to use in this challenge.

anytime you're importing a library, you gain access to a host of new functions. in order to call on those functions, you need to type out the name of the library, in this case "random", followed by a ".", followed by the particular function you're calling on. in this case (as in many others), you'll also need to include the object that the function is acting on (i.e. what you're taking a sample from). here you need to get a "sample" from the "cells" argument. what would be the syntax for that?