executing a while loop between defined time

python

Solution

You're not updating the value of `minute` inside while loop properly. You should recalculate the value of `now` in loop and then assign the new `now.minute` to `minute`.

while minute < 46 :
    print "test"
    time.sleep(5)
    now = datetime.datetime.now()
    minute = now.minute

Problem

I'm trying to execute a while loop only under a defined time like this, but the while loop continues its execution even when we are above the defined limit : ``` import datetime import time now = datetime.datetime.now() minute = now.minute while minute < 46 : print "test" time.sleep(5) minute = now.minute ``` How can stop the loop once we cross the limit ? Thanks

Original source