如果我想要一组If elif语句以单一顺序执行;例如:
if int(one[1]) == solution:和
if int(two[1]) == solution:要执行单个语句,请执行以下操作:
print "Hello World"输入它的最佳格式和语法正确的方式是什么?
我试过了:
if int(two[1]) == solution::
elif int(one[1]) == solution:
print "Hello World"和其他变体,但不能把我的数字放在正确的方式上。温柔点,StackOverflow,我编程时间不长。
我使用的编程语言是Python。谢谢!
更新:
我认为这是正确的答案,而不是阿卜杜勒·卡德尔。不过还是要谢谢你们。在Python中,我想我会输入:
if (int(one[1]) == solution OR int(two[1])== solution)):
print "Hello World"发布于 2011-05-24 20:48:17
if (int(one[1]) == solution) and (int(two[1]) == solution):
print 'Helloworld'https://stackoverflow.com/questions/6110601
复制相似问题