[Tutor] My number-guessing program

John Fouhy john at fouhy.net
Mon Oct 2 22:55:52 CEST 2006


On 03/10/06, Luke Paireepinart <rabidpoobear at gmail.com> wrote:
> Note that the random.randint function includes both endpoints (I.E. the
> numbers are 1-10 including 10)
> but the range() function doesn't include the last endpoint.

Which is why (in my not-so-humble opinion :-) ) we should tell people
to use random.randrange instead of random.randint!

(random.randrange takes up to 3 arguments with exactly the same
meanings as range())

-- 
John.


More information about the Tutor mailing list