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

code challenge

make a function named random_num that takes an int argument. Return a randint between 1 and the passed-in number.

1 Answer

Kenneth Love
STAFF
Kenneth Love
Treehouse Guest Teacher

So, make a function named random_num. That function will take an argument, which'll be an integer. Then give back (return) a random number between 1 and whatever number you were given.

So if your function gets 5 as the argument, it should give back a number between 1 and 5. If it gets 10, a number between 1 and 10.