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
Kang-Kyu Lee52,045 Points
my answer doesn't pass..
def nchoices(an_iterable, choose_num):
list_of_items = 
for _ in range(choose_num):
pop_item = an_iterable.pop(random.randrange(len(an_iterable)))
iterable = [1,2,3,4,5,6,7,8,9]
integer = 4
Maybe I did it wrong, only I couldn't figure what it is... it works at workspace
Kenneth LoveTreehouse Guest Teacher
It's not that there's anything that says to allow duplicates, nothing says to not allow duplicates, so you shouldn't assume that.
Hi kang kyu lee,
I don't think the challenge is specific enough on this but I think it wants the solution to allow duplicates. Whereas, you're popping off items and shortening the iist and making sure the same one isn't picked twice.
I changed your code so that instead of popping off the item at that random index you access the item at that index and it passed the challenge.
I have not been through this course so I don't know if there is something in the videos that would have hinted that you should allow duplicates here.