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 trialAlex Wall
4,086 PointsThe exercise is asking me if I've made a "random_num()" function, but I think I did.
Can you see what I may be doing wrong when you look at this code? Thank you.
import random
def random_num(number):
return randint(1,number)
Alex Wall
4,086 PointsI take that back, it didn't work.
This is my error message: " Bummer! Did you create random_num()
?"
2 Answers
Geoff Parsons
11,679 PointsYou're almost there. All you need to do is call the randint
function from the random
library.
import random
def random_num(number):
return random.randint(1, number)
Alex Wall
4,086 PointsAhhH! Thanks so much!
Alex Wall
4,086 PointsAlex Wall
4,086 PointsNever ye mind, apparently, it wanted me to call my random integer "int"