python - Checking if x>y without if statement -


in python, possible check whether x>y without using if statement?

there variety of ways go this:

print "yes" if x > y else "no" 

or:

print ["no", "yes"][x > y] 

or:

print x > y , "yes" or "no" 

(at least, mind-reading powers think you're doing)


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -