小问题不懂,求解惑
prompt = '''|--- 新建用户:N/n ---|
|--- 登录账号:E/e ---|
|--- 推出程序:Q/q ---|
|--- 请输入指令代码:'''
while True:
chosen = False
while not chosen:
choice = input(prompt)
if choice not in 'NnEeQq':
print('您输入的指令代码错误,请重新输入:')
else:
chosen = True
请问这 while not chosen: 这怎么理解
while not chosen:
相当于
while chosen == Flase 新手·ing 发表于 2018-2-11 17:43
相当于
是取反的意思吧 waitforlove 发表于 2018-2-11 17:50
是取反的意思吧
chosen = Flase
while 取反(chosen)=true
执行循环
这样理解可以不{:10_254:} waitforlove 发表于 2018-2-11 17:53
chosen = Flase
while 取反(chosen)=true
执行循环
可以可以。
等于号要两个哦。 给个最佳呗 新手·ing 发表于 2018-2-11 17:55
可以可以。
等于号要两个哦。
你的意思not chosen是个条件语句 返回true 或false
chosen=1
while not chosen: #whlile chosen==1: 相等就循环
{:10_250:}明白了 waitforlove 发表于 2018-2-11 18:01
你的意思not chosen是个条件语句 返回true 或false
chosen=1
while not chosen: #whlile chosen==1: ...
满意就给最佳呗。
,,,你这里可不是1.
页:
[1]