Inclusive? (Loops)


#1

Hello :slightly_smiling:

I don't understand why, say, randint(1, 10) would include the ten. Isn't it that it would only pick a number between 1-9? Does the randint function not work like range(i.e. range(1, 10) is between 1 through 9)?

Thanks!


#2

@betitochang96

Yuppers, range and randint are two completely different functions from two completely different modules.


#3

1 and 10 are inclusive boundaries.

random.randint(a, b)

Return a random integer N such that a <= N <= b. Alias for randrange(a, b+1).
https://docs.python.org/3/library/random.html


#4

Thanks guys :smile: I appreciate it.