Re: [Tutor] Beginner - understanding randint arguments

2014-02-15 Thread Steven D'Aprano
On Sat, Feb 15, 2014 at 04:25:34PM +, Marc Eymard wrote: > Can somebody explain why both low_range and high_range are still > returning their initial values ? Because you haven't changed either of them. Imagine the chaos if every time you did arithmetic on a variable, Python changed the var

Re: [Tutor] Beginner - understanding randint arguments

2014-02-15 Thread Alan Gauld
On 15/02/14 16:25, Marc Eymard wrote: Here is what happens in my script: >>> import random >>> low_range = -1 >>> high_range = 101 >>> random.randint(low_range + 1, high_range - 1) 56 >>> low_range -1 >>> high_range 101* I was rather expecting:

Re: [Tutor] Beginner - understanding randint arguments

2014-02-15 Thread Jay Lozier
On 02/15/2014 11:25 AM, Marc Eymard wrote: Hello Tutor, I need to generate a random integer between 0 and 100. The range is supposed to be adjusted by my two variables: low_range and high_range. The logic of using the variables as part of the function arguments is to manage to get a smaller

[Tutor] Beginner - understanding randint arguments

2014-02-15 Thread Marc Eymard
Hello Tutor, I need to generate a random integer between 0 and 100. The range is supposed to be adjusted by my two variables: low_range and high_range. The logic of using the variables as part of the function arguments is to manage to get a smaller range each time the function is called excludi