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 trialPatrick Hofer
817 PointsNow make a function named random_num that takes an int argument. Return a randint between 1 and the passed-in number.
Hi,
I really don't get what's wrong with my code..
Error message: It looks like Task 1 is no longer passing
Thanks for Help.
import random
def random_num(rd1)
return random.randint(1, rd1)
1 Answer
Cena Mayo
55,236 PointsTake a look here for a good discussion of this challenge.
Patrick Hofer
817 PointsPatrick Hofer
817 PointsThanks for your help Cena! It's so logic =) The variable rd1 in my function is undefined, i have to give the variable first a value!
Cheers!
Robert Richey
Courses Plus Student 16,352 PointsRobert Richey
Courses Plus Student 16,352 PointsThe only problem I had with your code in the challenge is that the function is missing a colon.
With this change, the code passes.