我的脚本中应该进行计算的部分没有任何反应

时间:2016-08-11 20:01:02

标签: python python-3.x

我刚刚开始使用python 3.5进行编程,在第一个程序中,我没有在程序的这一部分发生任何事情:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Body>
    <ExecCommandResponse xmlns="http://tempuri.org/">
      <ExecCommandResult>
        <Result xmlns="">
          <row>
            <LOT>VERL5B3002PL</LOT>
            <ID>115</ID>
            <WH>710</WH>
            <STPL>12</STPL>
          </row>
          <row>
            <LOT>VERL68804EVN</LOT>
            <ID>3716</ID>
            <WH>771</WH>
            <STPL>6</STPL>
          </row>
        </Result>
      </ExecCommandResult>
    </ExecCommandResponse>
  </soap:Body>
</soap:Envelope>

1 个答案:

答案 0 :(得分:-1)

这个答案是基于我的猜测,gender()是整个函数,如果没有给出有效的答案,你希望它在最后重复。请尝试下面的格式。

def gender():
    # There's obviously some code up here that eventually gives us var1 - var5
    # I'll assume var2 is an input from the user

    var2 = input("Enter your gender")

    v1 = int(var4)
    v2 = int(var5)

    guy_height = v1 + v2 + 13
    girl_height = v1 + v2 - 13

    v4 = guy_height / 2
    v5 = guy_height / 2

    if var2.lower() in ('boy', 'guy', 'male'):
        print ("Your estimated full-fledged height is, {}.".format(v4))

    elif var2.lower() in ('girl', 'female', 'woman'):
        print ("Your estimated full-fledged height is, {}.".format(v5))

    else:
        print ("Sorry, your gender is invalid. Please re-enter the answer.")
        gender()

gender()