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 Python Basics (Retired) Pick a Number! Any Number! Imports

random_number code not going through. I can't understand the problem

I it says that it can't seem to call the function with an argument

random_num.py
import random
def random_num(x):
  random.uniform(1,x)

2 Answers

Hi, Hela, you almost got it right, the method definition looks good, except that this challenge wants you to use the randint() method from the random library, not uniform().

import random

def random_num(x):
  return random.randint(1, x)

Oh thank you very much.