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 trialCarl Hicks
Java Web Development Techdegree Student 3,453 PointsAfter adding a the requested function I'm getting prompted that the original import statement is no longer passing.
I've not changed any thing in my the import statement, so I'm not sure why the test on the import statement is no longer passing?
# import statement
import random
# function
def random_num(x):
return randint(1, x)
2 Answers
Max Hirsh
16,773 PointsHey Carl. Sometimes the first task stops passing if there's some issue with a function later in the code. Your answer looks good, but remember that randint is a method of the random library. Library methods have to be called like this: library.method()
Hope this helps!
Max Hirsh
16,773 PointsOh ok! Glad you figured it out/sorry for inadvertently answering a question you already solved. But yes, you definitely have the right idea with only importing a specific function.
Carl Hicks
Java Web Development Techdegree Student 3,453 PointsCarl Hicks
Java Web Development Techdegree Student 3,453 PointsThanks ... I actually figured it out after testing it locally. It throws a more informative error. Normally I'd be more specific on something this small and do something like this:
But thanks for the quick response.