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

delphi - TJvHidDeviceController "DevicePath" always showing "\" -

web applications - Making Python scripts work on MAMP -

cocoa - Converting NSString to keyCode+modifiers for AXUIElementPostKeyboardEvent -