Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #97872
| Path | csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!nntp.club.cc.cmu.edu!micro-heart-of-gold.mit.edu!bloom-beacon.mit.edu!bloom-beacon.mit.edu!panix!not-for-mail |
|---|---|
| From | Grant Edwards <invalid@invalid.invalid> |
| Newsgroups | comp.lang.python |
| Subject | Re: If one IF is satisfied, skip the rest in the nest... |
| Date | Wed, 21 Oct 2015 20:07:21 +0000 (UTC) |
| Organization | PANIX Public Access Internet and UNIX, NYC |
| Lines | 47 |
| Message-ID | <n08r9p$h8g$1@reader1.panix.com> (permalink) |
| References | <50a6789a-3965-430b-9a91-b08adcedf7bf@googlegroups.com> <n08q5p$t7h$1@dont-email.me> |
| NNTP-Posting-Host | 67-130-15-94.dia.static.qwest.net |
| X-Trace | reader1.panix.com 1445458041 17680 67.130.15.94 (21 Oct 2015 20:07:21 GMT) |
| X-Complaints-To | abuse@panix.com |
| NNTP-Posting-Date | Wed, 21 Oct 2015 20:07:21 +0000 (UTC) |
| User-Agent | slrn/1.0.2 (Linux) |
| Xref | csiph.com comp.lang.python:97872 |
Show key headers only | View raw
On 2015-10-21, Denis McMahon <denismfmcmahon@gmail.com> wrote:
> On Wed, 21 Oct 2015 10:31:04 -0700, bigred04bd3 wrote:
>
>> So here what I have, I have a 3 IF's within the same level. If one IF
>> is satisfied, I would like to "skip" the other IFs and continue with my
>> code.
>
> c1 = wb1_sheet1.cell(row=cell + 1, column=2).value == 0 and
> wb1_sheet1.cell(row=cell + 1, column=3).value == 0
>
> c2 = wb1_sheet1.cell(row=cell + 2, column=2).value == 0 and
> wb1_sheet1.cell(row=cell + 2, column=3).value == 0
>
> c3 = wb1_sheet1.cell(row=cell + 3, column=2).value == 0 and
> wb1_sheet1.cell(row=cell + 3, column=3).value == 0
>
> if c1:
> if c2:
> if c3:
> # c1 && c2 && c3
> # 4 second open
> else:
> # c1 && c2
> # 3 second open
> else:
> # only c1
> # 2 second open
if c1 && c2 && c3:
pass # 4 seconds
elif c1 && c2:
pass # 3 seconds
elif c1:
pass # 2 seconds
Or if you want to be particulary obtuse:
seconds = {0b111:4, 0b110:3, 0b100:2}.get(c1<<2 | c2<<1 | c3<<0, None)
> Each condition only gets evaluated once.
OK.
--
Grant Edwards grant.b.edwards Yow! You were s'posed
at to laugh!
gmail.com
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
If one IF is satisfied, skip the rest in the nest... bigred04bd3@gmail.com - 2015-10-21 10:31 -0700
Re: If one IF is satisfied, skip the rest in the nest... Ian Kelly <ian.g.kelly@gmail.com> - 2015-10-21 11:39 -0600
Re: If one IF is satisfied, skip the rest in the nest... John Gordon <gordon@panix.com> - 2015-10-21 17:46 +0000
Re: If one IF is satisfied, skip the rest in the nest... bigred04bd3@gmail.com - 2015-10-21 10:55 -0700
Re: If one IF is satisfied, skip the rest in the nest... Denis McMahon <denismfmcmahon@gmail.com> - 2015-10-21 19:48 +0000
Re: If one IF is satisfied, skip the rest in the nest... Grant Edwards <invalid@invalid.invalid> - 2015-10-21 20:07 +0000
Re: If one IF is satisfied, skip the rest in the nest... Denis McMahon <denismfmcmahon@gmail.com> - 2015-10-22 02:08 +0000
csiph-web