2013-10-30 54 views
0
if choice == 'moments': 
    moments() 
    elif choice == 'kinetic energy': 
     kineticEnergy() 
     elif choice == 'gravitational potential energy': 
      gravtPotent() 
      else : 
       print('incorrect option') 

所以它只是继续说sytax错误或无效的sytax,在此之前和之后有更多的代码。 所以这是要么我不知道如何使用它,要么我的闲置被剔除。我使用defualt ide -idle,这是我下载它时给出的。我使用3.3.2elif在python中的声明3.3.2不按预期工作

回答

2

Elif应该没有缩进。以下将按预期工作

if choice == 'moments': 
    moments() 
elif choice == 'kinetic energy': 
    kineticEnergy() 
elif choice == 'gravitational potential energy': 
    gravtPotent() 
else : 
    print('incorrect option') 
+0

thx的帮助,我也修复了其他错误,我已经表示感谢。 – user2934587