[Tutor] "while" loop for satisfing two conditions , advice requested
Pujo Aji
ajikoe at gmail.com
Sun Jan 15 17:05:37 CET 2006
in understanding while loop someone should understand "if conditional"
first.
In "If conditional" there are common relational symbol "and" and "or"
Let's discuss "and" conditional
Condition 1 Condition 2 Result
True True True
True False False
False True False
False False False
In short, and equal True if and only if both condition are true.
"If the while loop result condition is true it will execute its block."
example:
x = 1
y = 1
while x==1 and y==1:
# it will be processed if x==1 and y==1 are both true, in this case it
is!
another example:
x=1
y=2
while x==1 and y==1:
# it will be processed if x==1 and y==1 are both true, in this case it
is not!
Hope this help!
pujo
On 1/15/06, John Joseph <jjk_saji at yahoo.com> wrote:
>
> Hi
> I am trying to use "while" loop , here I want
> while loop to check for two conditions , I am not
> getting an idea how to use "while" loop for checking
> two conditions
> I used "&" condition , but it is not
> giving me the expected results
> I used in this way
>
> while (condition no 1) & (condition no2):
> print "Results"
>
> I request guidance
> Thanks
> Joseph John
>
>
>
>
> ___________________________________________________________
> NEW Yahoo! Cars - sell your car and browse thousands of new and used cars
> online! http://uk.cars.yahoo.com/
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20060115/cdad57ff/attachment.html
More information about the Tutor
mailing list