Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Python Basics (Retired) Pick a Number! Any Number! Imports

I 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)

random_num.py
import random
random_num(x)
return random.randint(1,x)

2 Answers

Kenneth Love
STAFF
Kenneth Love
Treehouse Guest Teacher

You can't do a return outside of a function. You need to actually create a function for this challenge.

you 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.