y, December 12, 2023 3:58 AM
To: [email protected]
Subject: Re: A problem with str VS int.
Op 12/12/2023 om 9:22 schreef Steve GS via Python-list:
> With all these suggestions on
> how to fix it, no one seems to
> answer why it fails only when
> entering a two-digit number.
> O
On 12/12/23 21:22, Steve GS wrote:
With all these suggestions on
how to fix it, no one seems to
answer why it fails only when
entering a two-digit number.
One and three work fine when
comparing with str values. It
is interesting that the
leading 0 on a two digit
worked. Still, one digit and
thre
Op 12/12/2023 om 9:22 schreef Steve GS via Python-list:
With all these suggestions on
how to fix it, no one seems to
answer why it fails only when
entering a two-digit number.
One and three work fine when
comparing with str values. It
is interesting that the
leading 0 on a two digit
worked. Stil
now more of a
curiosity as I did use the
integer comparisons.
SGA
-Original Message-
From: Python-list
On
Behalf Of dn via Python-list
Sent: Sunday, December 10,
2023 12:53 AM
To: [email protected]
Subject: Re: A problem with
str VS int.
On 10/12/23 15:42, Steve GS
via Python-list
On 10/12/23 15:42, Steve GS via Python-list wrote:
If I enter a one-digit input or a three-digit number, the code works but if I
enter a two digit number, the if statement fails and the else condition
prevails.
tsReading = input(" Enter the " + Brand + " test strip reading: ")
On 12/9/2023 9:42 PM, Steve GS via Python-list wrote:
If I enter a one-digit input or a three-digit number, the code works but if I
enter a two digit number, the if statement fails and the else condition
prevails.
tsReading = input(" Enter the " + Brand + " test strip reading: ")
user can enter any text, they might enter ".01" or "hello" or al kinds of
nonsense.
If you converted to numbers and tested whether it failed, ...
-Original Message-
From: Python-list On
Behalf Of Steve GS via Python-list
Sent: Saturday, December 9, 2023 9:42 PM
To: pyth
If I enter a one-digit input or a three-digit number, the code works but if I
enter a two digit number, the if statement fails and the else condition
prevails.
tsReading = input(" Enter the " + Brand + " test strip reading: ")
if tsReading == "": tsReading = "0"
print(t
Alex Martelli wrote:
> Steve Holden <[EMAIL PROTECTED]> wrote:
>...
Get yourself a stuffed bear, and next time you have this kind of problem
spend a few minutes explaining to the bear exactly how your program
can't possibly be wrong. Works like a charm.
>>> A rubber ducky works m
"Alex Martelli" wrote
> Steve Holden wrote:
>...
> > >> Get yourself a stuffed bear, and next time you have this kind of
problem
> > >> spend a few minutes explaining to the bear exactly how your
program
> > >> can't possibly be wrong. Works like a charm.
> > >
> > > A rubber ducky works muc
Steve Holden <[EMAIL PROTECTED]> wrote:
...
> >> Get yourself a stuffed bear, and next time you have this kind of problem
> >> spend a few minutes explaining to the bear exactly how your program
> >> can't possibly be wrong. Works like a charm.
> >
> > A rubber ducky works much better for that,
On Mar 15, 5:31 pm, "Gabriel Genellina" <[EMAIL PROTECTED]>
wrote:
> The fact that a list comprehension "leaks" its variables into the
> containing scope is a bit weird.
> A generator expression doesn't:
>
> py> str
>
> py> w = (str for str in range(10))
> py> w
>
> py> str
>
> py> w.next()
>
Alex Martelli wrote:
> Steve Holden <[EMAIL PROTECTED]> wrote:
>
>> 7stud wrote:
>>> Sheesh! You would think that after looking at every inch of the code
>>> for way too many hours, at some point that would have poked me in the
>>> eye.
>>>
>>> Thanks all.
>>>
>> Get yourself a stuffed bear, and n
Steve Holden <[EMAIL PROTECTED]> wrote:
> 7stud wrote:
> > Sheesh! You would think that after looking at every inch of the code
> > for way too many hours, at some point that would have poked me in the
> > eye.
> >
> > Thanks all.
> >
> Get yourself a stuffed bear, and next time you have this ki
[EMAIL PROTECTED] writes:
> methodList = [str for str in names if callable(getattr(obj, str))]
>
> instead, do something like this:
>
> methodList = [i for i in names if callable(getattr(obj, i))]
or:
methodList = list(str for str in names if callable(getattr(obj, str)))
genexps, unlike lis
En Thu, 15 Mar 2007 17:32:24 -0300, <[EMAIL PROTECTED]> escribió:
> methodList = [str for str in names if callable(getattr(obj, str))]
>
> instead, do something like this:
>
> methodList = [i for i in names if callable(getattr(obj, i))]
The fact that a list comprehension "leaks" its variables int
7stud wrote:
> Sheesh! You would think that after looking at every inch of the code
> for way too many hours, at some point that would have poked me in the
> eye.
>
> Thanks all.
>
Get yourself a stuffed bear, and next time you have this kind of problem
spend a few minutes explaining to the bear
Sheesh! You would think that after looking at every inch of the code
for way too many hours, at some point that would have poked me in the
eye.
Thanks all.
--
http://mail.python.org/mailman/listinfo/python-list
"7stud" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
|I can't get the str() method to work in the following code(the last
| line produces an error):
If you 'print str' here
| methodList = [str for str in names if callable(getattr(obj, str))]
and again here, you will see the prob
On Mar 15, 2:49 pm, "7stud" <[EMAIL PROTECTED]> wrote:
> I can't get the str() method to work in the following code(the last
> line produces an error):
>
>
> class test:
> """class test"""
> def __init__(self):
> """I am init func!"""
> s
7stud wrote:
> I can't get the str() method to work in the following code(the last
> line produces an error):
>
>
> class test:
> """class test"""
> def __init__(self):
> """I am init func!"""
> self.num = 10
> self.num2
Don't use built-ins as variable names. Your code will work if you
change this:
> methodList = [str for str in names if callable(getattr(obj, str))]
to this:
> methodList = [s for s in names if callable(getattr(obj, s))]
--
http://mail.python.org/mailman/listinfo/python-list
I can't get the str() method to work in the following code(the last
line produces an error):
class test:
"""class test"""
def __init__(self):
"""I am init func!"""
self.num = 10
self.num2 = 20
def someFunc(self):
23 matches
Mail list logo