为什么我的Python代码会不断重复?

时间:2015-08-30 02:29:17

标签: python

class Lust(Scene): # create a class Lust that is-a scene

def enter(self): # create a function named enter
    print "             Virgil leads you on to the second circle of Hell: Lust. \n "
    print "             In this circle, you sees Semiramis, Dido, Cleopatra, "
    print "             Helen of Troy, Achilles, Paris, Tristan, and many others"
    print "             who were overcome by sexual love during their life."
    print "             They are the first ones to be truly punished in Hell. These souls"
    print "             are blown back and forth by the terrible winds of a violent storm, without rest. \n"
    print "         Virgil: To move on to the next circle, we must dodge these violent winds."
    print "         Virgil: Go forth, and dodge when you feel the winds... \n"
    for steps in range (0, 5):
        windblowing = random.randint(1,6)
        if windblowing < 0:
            print "The wind is blowing, violently!  What do you do?"
            windact = raw_input("> ")
            steps + 1
            if windact == "dodge":
                steps + 1
            else:
                print "I don't know what you mean."
                steps + 1
        elif windblowing > 0:
            print "The winds seemed to have died down.  You should take another step."
            windact2 = raw_input("> ")
            if windact2 == "step":
                print "You step carefully..."
                steps + 1
            else: 
                print "I don't know what you mean."
                steps + 1
        else:
            print "oops! something broke."
    if steps == 4:
        print "You made it!"
    return 'Gluttony'

如果我运行更大的代码片段,它会在返回之前运行两次&#34;你做到了!&#34;当玩家成功并且#34;走过时。&#34;怎么会?

0 个答案:

没有答案
相关问题