Python:程序不检查完整或状态

2024-09-29 23:29:38 发布

您现在位置:Python中文网/ 问答频道 /正文

需要一些援助:

我在OR操作数方面遇到了一些问题…我理解它是如何工作的(OR条件必须为true),但我不确定它为什么会以下面解释的方式运行

“or”语句似乎没有检查“FlowControl”函数中的第二个条件。。当我输入“y”时,它会看到条件为真,并且运行时没有任何问题。。。但是,当我输入“是”时,它会将条件评估为false

-我排除了其他功能-

def flowControl():
    answer = input("do you want run the 'displayLession' function? ( yes or 
    no)").strip()
    if answer == ('y' or 'yes'):
        displayLesson()
else:
    userTime()
    print('End program')

流量控制()


Tags: or函数answer功能falsetrueinputdef

热门问题