Hi, I am well aware that this is a 'wrong' question on many levels but please do bear with me. I'm working on a locked-down school system so am having to use an online Python IDE, which I think due to the locked-down nature of the school system can import the time module, but can't execute the time.sleep() method. As a result, I can't put a delay into a little zombie text game that I wanted to get some students to do (code below). I thought that a cack-handed solution might be to create a sleep function from a while loop executing a large number of times, in order to make it seem like there was a pause in the game. However, although the code executes successfully, the pause doesn't actually happen at the right moment. I would expect a pause whenever the sleep2() function is invoked, but instead, the print output lines that are after the sleep2() function in the code tend to be executed before the pause. I know this is all so, so wrong, but I'd appreciate an explanation of why the pause doesn't occur when I expect it to. Don't worry, I will not be teaching this to students!
- Code: Select all
while i < 1000000:
i += 1
print "welcome to Zombieland"
print "Keep away from the Zombies"
character=raw_input("Type a name for character here >")
print "Turn away now %s, YOU HAVE BEEN WARNED!" %(character)
print "Jack Swan: AAAAAAAAGGGGGHHHHHH!!!........RUUUUUUUUUUNNNNNNNN"
print "Jack Swan: There are at least 15 zombies heading our way!"