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 (Retired) Dungeon Game Random Choices

Can somebody rephrase the question, without giving the solution?

I don't understand the question or task, making it impossible to solve. So can somebody rephrase this question, without giving the solution?

Create a function named nchoices() that takes an iterable and an integer. The function should return a list of n random items from the iterable where n is the integer. Duplicates are allowed.

1 Answer

The challenge is asking you to take an iterable and an integer (exactly as it said), and return a list of n (the integer is n) random numbers from the iterable.

Here are the steps to take:

  1. Add a random value from the iterable to a list.
  2. Repeat that n times (where n is the integer)

Good luck! ~alex

EDITED