预计一个缩进的块无法找到问题

时间:2017-09-13 10:14:48

标签: python python-3.x

所以我一直致力于我自己的文明游戏,我正在努力,所以你可以改变税收,但我得到这个错误的一个关于你在税收改变的事情中的选择,这是代码:

moneytalk = int(input("your people doesn't like the new tax do you want to tell them why you have made it so high? 1 = yes, 2 = no"))
if moneytalk == 1:
    talkingmoney = int(input("1 = we have been losing so much money that the goverment needs more, 2 = we have trades that we need to have money for, 3 = its under our avrage right now so we need to higher it"))
    if talkingmoney == 1:
        if my_stats_on_my_city["Gold"] <= 1000:
             print ("your people belive in you and they are no angry with you")
        else:
            moneyrandom = randint(1, 10)
            if moneyrandom >= 6:
                print ("they belive you")
            else:
                print ("they know you are lying and are even more upset now")
                My_people_info["Happines"] -= 5;
                My_people_info["Happines"] -= int(higher);
    elif talkingmoney == 2:
        pass #i will add here after the trading system
    elif talkingmoney == 3:
elif moneytalk == 2:
    My_people_info["Happines"] -= 3;
    My_people_info["Happines"] -= int(higher);

我收到以下错误:

elif moneytalk == 2:
IndentationError: expected an indented block

2 个答案:

答案 0 :(得分:0)

    elif talkingmoney == 2:
        pass #i will add here after the trading system
    elif talkingmoney == 3:
elif moneytalk == 2:
    My_people_info["Happines"] -= 3;
    My_people_info["Happines"] -= int(higher);

您在elif talkingmoney == 3:分支下没有任何代码。至少需要pass声明。

答案 1 :(得分:0)

moneytalk = int(input("your people doesn't like the new tax do you want to tell them why you have made it so high? 1 = yes, 2 = no"))
if moneytalk == 1:
    talkingmoney = int(input("1 = we have been losing so much money that the goverment needs more, 2 = we have trades that we need to have money for, 3 = its under our avrage right now so we need to higher it"))
    if talkingmoney == 1:
        if my_stats_on_my_city["Gold"] <= 1000:
             print ("your people belive in you and they are no angry with you")
        else:
            moneyrandom = randint(1, 10)
            if moneyrandom >= 6:
                print ("they belive you")
            else:
                print ("they know you are lying and are even more upset now")
                My_people_info["Happines"] -= 5;
                My_people_info["Happines"] -= int(higher);
    elif talkingmoney == 2:
        pass #i will add here after the trading system
    elif talkingmoney == 3:
      # You need to paas any statement over here
elif moneytalk == 2:
    My_people_info["Happines"] -= 3;
    My_people_info["Happines"] -= int(higher);

您需要在

下填写此处的任何声明
  

elif talkingmoney == 3: