我的序列的邏輯等效性嚴重不足的睡眠,我需要幫助重寫邏輯的這個小Python的一塊如果否則如果else子句
for _ in range(100):
if a:
continue
elif b:
continue
elif c and d:
continue
else:
e()
我想有像
if (some_exprt of a,b,c,d):
e()
我得到的是:
if not a and not b and (not c or not d):
e()
,但我真的不能告訴我們,如果這是正確與否,對嗎?
究竟是你想做些什麼? –
試着從「自下而上」思考它。 「如果a或b或c和d都不爲真,則執行e()」 –
您可以使用[De_Morgan's_laws](http://en.wikipedia.org/wiki/De_Morgan's_laws)將答案轉換爲@Martijn給出 –