On Wed, Oct 15, 2014 at 10:04 AM, giacomo boffi wrote:
> Tim Chase writes:
>
>> On 2014-10-12 22:16, Marko Rauhamaa wrote:
>>> is equivalent with
>>>
>>> while ans.lower()[0] != 'y':
>>> ans = input('Do you like python?')
>>
>> And still better improved with
>>
>> while ans[:1].low
Tim Chase writes:
> On 2014-10-12 22:16, Marko Rauhamaa wrote:
>> is equivalent with
>>
>> while ans.lower()[0] != 'y':
>> ans = input('Do you like python?')
>
> And still better improved with
>
> while ans[:1].lower() != 'y':
> ans = input('Do you like python?')
yok is Turk
On 10/13/2014 11:12 AM, Rustom Mody wrote:
> On Monday, October 13, 2014 10:13:20 PM UTC+5:30, Rob Gaddi wrote:
>> On Mon, 13 Oct 2014 09:26:57 -0700 (PDT)
>> Rustom Mody wrote:
>
>>> On Monday, October 13, 2014 9:43:03 PM UTC+5:30, Rob Gaddi wrote:
On Mon, 13 Oct 2014 09:56:02 +1100
St
On Monday, October 13, 2014 10:13:20 PM UTC+5:30, Rob Gaddi wrote:
> On Mon, 13 Oct 2014 09:26:57 -0700 (PDT)
> Rustom Mody wrote:
> > On Monday, October 13, 2014 9:43:03 PM UTC+5:30, Rob Gaddi wrote:
> > > On Mon, 13 Oct 2014 09:56:02 +1100
> > > Steven D'Aprano wrote:
> > > > When you have mul
On Mon, 13 Oct 2014 09:26:57 -0700 (PDT)
Rustom Mody wrote:
> On Monday, October 13, 2014 9:43:03 PM UTC+5:30, Rob Gaddi wrote:
> > On Mon, 13 Oct 2014 09:56:02 +1100
> > Steven D'Aprano wrote:
> > > When you have multiple clauses in the condition, it's easier to reason
> > > about
> > > them i
On Monday, October 13, 2014 9:43:03 PM UTC+5:30, Rob Gaddi wrote:
> On Mon, 13 Oct 2014 09:56:02 +1100
> Steven D'Aprano wrote:
> > When you have multiple clauses in the condition, it's easier to reason about
> > them if you write the clauses as positive statements rather than negative
> > stateme
On Mon, 13 Oct 2014 09:56:02 +1100
Steven D'Aprano wrote:
>
> When you have multiple clauses in the condition, it's easier to reason about
> them if you write the clauses as positive statements rather than negative
> statements, that is, "something is true" rather than "something is not
> true",
On Mon, Oct 13, 2014 at 11:09 PM, Marko Rauhamaa wrote:
> Chris Angelico :
>
>> Or, even simpler: Use an active condition.
>>
>> while input('Do you like python?') not in ('yes', 'y'): pass
>
> Instead of the traditional "pull" technology, you could take advantage
> of the state-of-the-art "push"
On Mon, Oct 13, 2014 at 11:10 PM, Skip Montanaro
wrote:
> On Mon, Oct 13, 2014 at 6:59 AM, Chris Angelico wrote:
>>
>> while input('Do you like python?') not in ('yes', 'y'): pass
>
>
> Unfortunately, you probably have to account for people who SHOUT:
>
> while input('Do you like python?').lo
On Mon, Oct 13, 2014 at 6:59 AM, Chris Angelico wrote:
> while input('Do you like python?') not in ('yes', 'y'): pass
Unfortunately, you probably have to account for people who SHOUT:
while input('Do you like python?').lower() not in ('yes', 'y'): pass
Skip
--
https://mail.python.org/m
Chris Angelico :
> Or, even simpler: Use an active condition.
>
> while input('Do you like python?') not in ('yes', 'y'): pass
Instead of the traditional "pull" technology, you could take advantage
of the state-of-the-art "push" approach:
print("You must love python -- everybody does!")
Mar
On Mon, Oct 13, 2014 at 7:31 PM, Gelonida N wrote:
> Taking into account the Steven's suggestion about using the 'in' expression
> it could be:
>
>
> while True:
> ans = input('Do you like python?')
> if ans.lower() in ('yes', 'y'):
> break
Or, even simpler: Use an active conditio
On 10/12/2014 07:08 PM, Shiva wrote:
while ans.lower() != 'yes' or ans.lower()[0] != 'y':
ans = input('Do you like python?')
I personally consider double negations less intuitive than following:
while not( ans.lower() == 'yes' and ans.lower()[0] == 'y' ):
Reading this line yoy would ha
On Mon, Oct 13, 2014 at 11:43 AM, Dennis Lee Bieber
wrote:
> ONE: Python uses short circuit evaluation: for an OR, the second
> clause
> is only looked at if the first clause is FALSE (for an AND, the first
> clause has to be TRUE before the second is evaluated).
Short-circuiting doesn't
Tim Chase wrote:
> On 2014-10-12 22:16, Marko Rauhamaa wrote:
>> is equivalent with
>>
>> while ans.lower()[0] != 'y':
>> ans = input('Do you like python?')
>
> And still better improved with
>
> while ans[:1].lower() != 'y':
> ans = input('Do you like python?')
The intenti
On 2014-10-12 22:16, Marko Rauhamaa wrote:
> is equivalent with
>
> while ans.lower()[0] != 'y':
> ans = input('Do you like python?')
And still better improved with
while ans[:1].lower() != 'y':
ans = input('Do you like python?')
in the event that len(ans)==0 (a situation whi
On Sun, 12 Oct 2014 17:08:00 +, Shiva wrote:
> while ans.lower() != 'yes' or ans.lower()[0] != 'y':
while ans.lower() is not equal to "yes"
or ans.lower()[0] is not equal to "y"
the loop will continue to run
Note that if ans.lower() == 'y', then the first clause ( ans.lower() !=
'yes' )
On Mon, Oct 13, 2014 at 6:16 AM, Marko Rauhamaa wrote:
> The corrected version
>
> while ans.lower() != 'yes' and ans.lower()[0] != 'y':
> ans = input('Do you like python?')
>
> is equivalent with
>
> while ans.lower()[0] != 'y':
It's true that the first part is redundant, but tr
Chris Angelico :
> On Mon, Oct 13, 2014 at 4:59 AM, Shiva
> wrote:
>> Bit confusing to use in While loop - Should have used the 'and' condition
>> instead of OR- then it works fine.
>> for OR both condition need to be false to produce a false output and break
>> the loop.
>
> Correct, what you're
On Mon, Oct 13, 2014 at 4:59 AM, Shiva
wrote:
> Bit confusing to use in While loop - Should have used the 'and' condition
> instead of OR- then it works fine.
> for OR both condition need to be false to produce a false output and break
> the loop.
Correct, what you're looking for here is indeed a
Bit confusing to use in While loop - Should have used the 'and' condition
instead of OR- then it works fine.
for OR both condition need to be false to produce a false output and break
the loop.
More of SET operations.
Thanks,
Shiva
--
https://mail.python.org/mailman/listinfo/python-list
On Mon, Oct 13, 2014 at 4:21 AM, Shiva
wrote:
>> The loop will continue while either part is true - that's what "or"
>> means. Is that what you intended it to be doing?
>>
>> ChrisA
>>
>
>
> Yes..however, the second part of the or condition doesn't get evaluated.
> So if I enter a 'y' - I expe
In article ,
Shiva wrote:
> Why is the second part of while condition not being checked?
>
> while ans.lower() != 'yes' or ans.lower()[0] != 'y':
> ans = input('Do you like python?')
>
>
> My intention is if either of the conditions are true the loop should break.
> But the condition aft
> The loop will continue while either part is true - that's what "or"
> means. Is that what you intended it to be doing?
>
> ChrisA
>
Yes..however, the second part of the or condition doesn't get evaluated.
So if I enter a 'y' - I expect the second part to evaluate and the loop to
break -
On Mon, Oct 13, 2014 at 4:08 AM, Shiva
wrote:
> Why is the second part of while condition not being checked?
>
> while ans.lower() != 'yes' or ans.lower()[0] != 'y':
> ans = input('Do you like python?')
>
>
> My intention is if either of the conditions are true the loop should break.
> But th
25 matches
Mail list logo