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 Object-Oriented Python Instant Objects Methods

what can do .randint()

can some one tell me why the function is used. Or What the definition of this function.

random.randint(0, 1)
.raindint() # ?????????????????

1 Answer

Serkan van Delden
Serkan van Delden
13,094 Points

It is used to give a variable a random value. Example: variable = randint(0, 10). This gives "variable" a random value of 0 to 10. Don't forget to import random!