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

Selvaraj Rajabhathor
Selvaraj Rajabhathor
Courses Plus Student 460 Points

return randint quiz is wrong

the answer doesnt seem to work

import random
def random_num(i)
  return randint(1,i)

2 Answers

Chase Marchione
Chase Marchione
155,055 Points

Hi Selvaraj,

1) We need to include a colon at the end of the function header to let the compiler know that that's the end of the header. 2) You do want to call the randit function, but you'll want to put the class name and a period at the beginning of your call, so that the compiler knows what class the randint method belongs to (so that it can find it.)

import random

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

Hope this helps.