To check if number is in range(x,y)
2QdxY4RzWzUUiLuE at potatochowder.com
2QdxY4RzWzUUiLuE at potatochowder.com
Mon Dec 14 17:37:13 EST 2020
On 2020-12-14 at 21:21:43 +0000,
"Schachner, Joseph" <Joseph.Schachner at Teledyne.com> 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)
<class 'range'>
>>> l = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> type(l)
<class 'list'>
>>> r == l
False
> You have just discovered that Python, although it is dynamically
> typed, is STRICTLY typed. Another way to say this: you have
> discovered that Python isn't the same as BASIC ...
Citation needed? I can't speak for every version of BASIC ever, but the
ones I used had separate namespaces for numeric variables and string
variables: A was a number, A$ was a string, and never the twain shall
meet. That's strict typing.
More information about the Python-list
mailing list