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 trialPeter Buechler
1,737 PointsBaffling error message when testing nchoices().
The code challenge is pretty straight forward. In my test in python on my own machine, a simple function works.
I begin with the obvious:
def nchoices(anIterable, n):
# rest of code goes here
However, the evaluator prints "Bummer, can't find nchoices()"
Not sure what's happening ++++++++++++
After writing the function correctly in a local Python environment, I neglected to import random, when running it in treehouse.
If I had done this in a local environment, Python would have complained with
NameError: name 'random' is not defined
Which makes sense, whereas the Treehouse error message did not 8-(
2 Answers
Jason Anello
Courses Plus Student 94,610 PointsHi Peter,
Did you import the random
module?
Kenneth Love
Treehouse Guest TeacherThere's nothing in your nchoices
function, so it's causing the interpreter to break and not actually register your function.