Re: To check if number is in range(x,y)

2020-12-14 Thread Tim Chase
On 2020-12-14 21:21, Schachner, Joseph wrote: > >>> r = range(10) > So r is a list containing 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 In Python 3.x, r is *not* a list. It is a custom object/class. > >>> 2 in r > True > As expected. I'm not sure what your replies are suggesting here. I demonstrate

Re: To check if number is in range(x,y)

2020-12-14 Thread Dan Stromberg
On Mon, Dec 14, 2020 at 3:07 PM Dan Stromberg wrote: > > On Mon, Dec 14, 2020 at 1:23 PM Schachner, Joseph < > joseph.schach...@teledyne.com> wrote: > >> >>> r = range(10) >> So r is a list containing 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 >> > To get a list of consecutive int's, you can use, for EG: > r =

Re: To check if number is in range(x,y)

2020-12-14 Thread Dan Stromberg
On Mon, Dec 14, 2020 at 1:23 PM Schachner, Joseph < joseph.schach...@teledyne.com> wrote: > >>> r = range(10) > So r is a list containing 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 > To get a list of consecutive int's, you can use, for EG: r = list(range(10)) -- https://mail.python.org/mailman/listinfo/python-

Re: To check if number is in range(x,y)

2020-12-14 Thread 2QdxY4RzWzUUiLuE
On 2020-12-14 at 21:21:43 +, "Schachner, Joseph" wrote: > >>> r = range(10) > So r is a list containing 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 In a number of ways, r behaves as if it were that list, but r is definitely not that list: >>> r = range(10) >>> type(r) >>> l = [0, 1, 2, 3,

RE: To check if number is in range(x,y)

2020-12-14 Thread Schachner, Joseph
nd you read Python 101 and when you've done that, read Python 201. I think they are very good "learn Python" books. If you're surprised that the end point is not included in range, you need to read Python 101. --- Joseph S. -----Original Message- From: Tim Chase Sent: Sat

Re: To check if number is in range(x,y)

2020-12-12 Thread Bischoop
On 2020-12-12, Tim Chase wrote: > > Hopefully this gives you the hints that you need to troubleshoot. > > -tkc > > > > Yes it explains a lot. Thanks -- https://mail.python.org/mailman/listinfo/python-list

Re: To check if number is in range(x,y)

2020-12-12 Thread 2QdxY4RzWzUUiLuE
On 2020-12-12 at 10:51:00 -0600, Tim Chase wrote: > If you want numeric-range checks, Python provides the lovely > double-comparison syntax: > > >>> x = 5 > >>> 2 < x < 10 > True Not just numbers: >>> 'm' < 'n' < 'o' True >>> 'one' < 'one point five' < 'two' True Okay,

Re: To check if number is in range(x,y)

2020-12-12 Thread Tim Chase
On 2020-12-12 15:12, Bischoop wrote: > I need to check if input number is 1-5. Whatever I try it's not > working. Here are my aproaches to the problem: https://bpa.st/H62A > > What I'm doing wrong and how I should do it? A range is similar to a list in that it contains just the numbers listed:

Re: To check if number is in range(x,y)

2020-12-12 Thread Bischoop
Got it solved here: https://bpa.st/BFJA -- https://mail.python.org/mailman/listinfo/python-list

Re: To check if number is in range(x,y)

2020-12-12 Thread Oscar
In article , Bischoop wrote: > >I need to check if input number is 1-5. Whatever I try it's not working. >Here are my aproaches to the problem: https://bpa.st/H62A > >What I'm doing wrong and how I should do it? You need to learn about types. ;-) Input returns a string. That string is not in th

To check if number is in range(x,y)

2020-12-12 Thread Bischoop
I need to check if input number is 1-5. Whatever I try it's not working. Here are my aproaches to the problem: https://bpa.st/H62A What I'm doing wrong and how I should do it? -- Thanks -- https://mail.python.org/mailman/listinfo/python-list

Re: To check if number is in range(x,y)

2020-12-12 Thread Bischoop
I've also convert the choice to int() but doesn't help. -- https://mail.python.org/mailman/listinfo/python-list

Re: To check if number is in range(x,y)

2020-12-12 Thread Bischoop
On 2020-12-12, Oscar wrote: > In article , > Bischoop wrote: >>I've also convert the choice to int() but doesn't help. > > Oh.. did not read this yet. How did you do this? In both places after > the input or during the comparison? If so, in which version? Only the > first version would work. The

Re: To check if number is in range(x,y)

2020-12-12 Thread Oscar
In article , Bischoop wrote: >I've also convert the choice to int() but doesn't help. Oh.. did not read this yet. How did you do this? In both places after the input or during the comparison? If so, in which version? Only the first version would work. The other two are just plain wrong. -- [J|O