【发布时间】:2014-10-27 22:37:15
【问题描述】:
我有这个代码:
def the_flying_circus():
if True and True and True and not False:
print "Kevin stinkt"
elif 10 < 4:
print "Justin stinkt"
else:
print "herb-wuerzig"
当我print the_flying_circus 我得到Kevin stinkt 打印,None 作为回报。我需要False 作为在线教程的回报。为什么我会得到None,我怎样才能获得True?
【问题讨论】:
-
“我得到 Kevin stinkt 作为回报” - 不正确。函数打印
'Kevin stinkt'并返回None。参见例如stackoverflow.com/q/7664779/3001761.
标签: python if-statement printing controls