Something I forgot to add. This idea of side-effects with the conditionals is
actually the whole point of the Python built-in functinos any() and all().
any() will evaluate a generator expression and stops when one of them
evaluates to True, and all() works the same, but stops when a False is
On Saturday, April 19, 2014, Vipul Sharma wrote:
> Hello,
>
> Suppose we want some block of code to be executed when both '*a'* and
> '*b'*are equal to say 5. Then we can write like :
>
> *if a == 5 and b == 5:*
> *# do something*
>
> But a few days ago, I just involuntarily wrote a similar
Alan Gauld Wrote in message:
> On 19/04/14 21:48, Vipul Sharma wrote:
>
>> *if a == 5 and b == 5:*
>> *# do something*
>>
>> *if a == b and b == 5:*
>> *# do something *
>>
>> which made me think, is there any difference between the two ?
>
> Yes.
> I don't know how python actually does
On 19/04/14 21:48, Vipul Sharma wrote:
*if a == 5 and b == 5:*
*# do something*
*if a == b and b == 5:*
*# do something *
which made me think, is there any difference between the two ?
Yes.
I don't know how python actually does it but in a general
sense there is not much if any diffe
Peter Otten wrote:
> In mathematics there is a property called "transitivity" which basically
> says that an operation op is transitive if from
>
> (a op b) and (a op c)
>
> follows
>
> b op c
I opened the wikipedia article for the english word, but didn't start
reading it until after I had h
Vipul Sharma wrote:
> Hello,
>
> Suppose we want some block of code to be executed when both '*a'* and
> '*b'*are equal to say 5. Then we can write like :
>
> *if a == 5 and b == 5:*
> *# do something*
>
> But a few days ago, I just involuntarily wrote a similar condition check
> as
> :
>
> From: Vipul Sharma
>To: tutor@python.org
>Sent: Saturday, April 19, 2014 10:48 PM
>Subject: [Tutor] equality check difference
>
>
>
>Hello,
>
>
>Suppose we want some block of code to be executed when both 'a' and
Hello,
Suppose we want some block of code to be executed when both '*a'* and
'*b'*are equal to say 5. Then we can write like :
*if a == 5 and b == 5:*
*# do something*
But a few days ago, I just involuntarily wrote a similar condition check as
:
*if a == b and b == 5:*
*# do something *
Tyler Simko writes:
> I'm embarrassingly new at Python, so please forgive my probably simple
> mistakes.
Welcome, and congratulations on starting with Python!
No forgiveness needed for asking questions or making mistakes; the
important thing is to learn from both.
> So I called readlines() on
On 02/03/2014 23:38, Danny Yoo wrote:
The call to readlines () has a return value that is currently being
dropped to the floor. Look at its value.
Feel free to ask more questions. Good luck!
He'll need it after reading my response, I must stop replying when I'm
knackered and not thinking s
On 02/03/14 21:10, Tyler Simko wrote:
So I called readlines() on a file, and I'm wondering how
> I can check the equality of a specific line with a raw_input
file = open('filename.txt,' 'r')
file.readlines()
This opens the file and reads all the lines but it
doesn't store the result anywher
The call to readlines () has a return value that is currently being dropped
to the floor. Look at its value.
Feel free to ask more questions. Good luck!
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail
On Mar 2, 2014 6:30 PM, "Mark Lawrence" wrote:
>
> On 02/03/2014 21:10, Tyler Simko wrote:
>>
>> Hi all!
>>
>> I'm embarrassingly new at Python, so please forgive my probably simple
mistakes.
>>
>> So I called readlines() on a file, and I'm wondering how I can check the
equality of a specific line
On 02/03/2014 21:10, Tyler Simko wrote:
Hi all!
I'm embarrassingly new at Python, so please forgive my probably simple mistakes.
So I called readlines() on a file, and I'm wondering how I can check the
equality of a specific line with a raw_input set variable as a condition. For
example,
fil
Hi all!
I'm embarrassingly new at Python, so please forgive my probably simple
mistakes.
So I called readlines() on a file, and I'm wondering how I can check the
equality of a specific line with a raw_input set variable as a condition. For
example,
file = open('filename.txt,' 'r')
file.read
15 matches
Mail list logo