Hello All,
I have been working on a class project, which is due tomorrow and I completed the project but I misinterpreted a requirement. I need a function which only runs for a certain given amount of time. Lets say 60seconds. I generate a while loop, that is dependent on the timer function and when 60seconds has expired the loop breaks, however this break function does not propagate into other called modules, nested whiles, and if loops. I am not sure if there is a better way to do this but I don’t have too much experience with Python and I am not aware of other options with handling this in Python. Any help would be appreciated. Here is the simplified structure of my python script, also if there is an option to break in the middle of the module would the return variables still be returned? I have tried it a couple of ways below is the latest of my attempts.
I have been working on a class project, which is due tomorrow and I completed the project but I misinterpreted a requirement. I need a function which only runs for a certain given amount of time. Lets say 60seconds. I generate a while loop, that is dependent on the timer function and when 60seconds has expired the loop breaks, however this break function does not propagate into other called modules, nested whiles, and if loops. I am not sure if there is a better way to do this but I don’t have too much experience with Python and I am not aware of other options with handling this in Python. Any help would be appreciated. Here is the simplified structure of my python script, also if there is an option to break in the middle of the module would the return variables still be returned? I have tried it a couple of ways below is the latest of my attempts.
Class Function 2: _init_ program def module1: code code def module2: code code def module 3: code code def time_module: while True: code code code While Code If Code Code module3() code module2() if b >= 60: break code finish main: Function2()