How to stop the program as soon as one of the condition is met
Chris Rebert
clp2 at rebertia.com
Mon Apr 16 15:57:04 EDT 2012
On Mon, Apr 16, 2012 at 12:06 PM, Chinesekidz
<chinesekidz at googlemail.com> wrote:
> Hello Guys:
>
> How can I stop the program as soon as one of the condition is met?
>
>
> Here is example:
>
> The loop should be stop asking for more input if a=b or c=6.
>
> I tried to write one but it only stop when a=b and not when c=6
Please post the code from your attempt next time. That way, we can
explain where the error lies in your code.
Assuming input should be asked for at least once:
while True:
get_more_input()
if a == b or c == 6:
break
Assuming not asking for input at all is permissible:
while a != b and c != 6:
get_more_input()
Cheers,
Chris
More information about the Python-list
mailing list