Python three head operations

There are three projects in operation c language and the Java language.

Similar alternatives only in python, if the result of a> b is true, h = "variable 1", if false, h = "variable 2"

例如:
a = 8
b = 2
h = ""
h = "变量1" if a > b else "变量2"
print(h)
运行结果:
变量1

Guess you like

Origin blog.csdn.net/MZP_man/article/details/92572292