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!
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
I am having a problem with this exercise. I get the message, "Bummer! Did you create random_num()" -- but the instructio
I am having a problem with this exercise. I get the message, "Bummer! Did you create random_num()" -- but the exercise calls for the function to accept an argument of type int. How am I supposed to get the function random_num() -- which accepts no arguments to accept one argument?
import random def random_num(): return randint(1,number)
Dan Johnson40,532 Points
Despite the error message random_num should take a single argument. The issue you were probably running into was not specifying the module for randint:
Dan, thanks for answering. I did forget to call the module for randint. The help messages for the Challenge seem to be out of sync with the actual problem. The response from the Challenge "Check Work" when I attempt to submit the answer with the missing modules asks me if I created "rand_num()" -- which is the wrong approach. Does someone need to fix the message given by the Challenge in this case?