小编mas*_*sti的帖子

如何在python中使用比较和'如果不是'?

在我的一个程序中,我怀疑我是否正确使用了比较.我想在做某事之前确保(u0 <= u <u0 +步骤).

if not (u0 <= u) and (u < u0+step):
    u0 = u0+ step # change the condition until it is satisfied
else:
    do something. # condition is satisfied
Run Code Online (Sandbox Code Playgroud)

python

33
推荐指数
2
解决办法
17万
查看次数

标签 统计

python ×1