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 trialdanielplaisimnd
6,837 PointsPython
Now make a function named random_num that takes an int argument. Return a randint between 1 and the passed-in number.
Help me solve this question please
1 Answer
Kenneth Love
Treehouse Guest TeacherCan you show what code you've written trying to pass this? It really helps for us to see where you're getting stuck.
danielplaisimnd
6,837 Pointsdanielplaisimnd
6,837 Pointsthis is my code
Kenneth Love
Treehouse Guest TeacherKenneth Love
Treehouse Guest TeacherThe contents of a function have to be indented compared to the definition of the function. Also, function definitions (your first line) need to end with a colon (':
). And, lastly, you need to actually
return` a value from the function. Unlike Ruby and some other languages, Python doesn't do automatic returns.