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 trialSanchari Bhattacharya
Courses Plus Student 5,751 PointsI am having problem with this problem import random radon_num(x) return random.randint(1,x)
So the code challenege is to import random library and return randint between 1 and the input number. My code is import random randon-num(x) returm random.randint(1,x)
import random
random_num(x)
return random.randint(1,x)
2 Answers
Kenneth Love
Treehouse Guest TeacherYou can't do a return
outside of a function. You need to actually create a function for this challenge.
Gordon Reeder
2,521 Pointsyou forgot the def.
def random_num(x):
with that, you are now defining a function. Don't forget to indent the code block of the function.