Jul-31-2023, 03:17 PM
(This post was last modified: Jul-31-2023, 04:00 PM by deanhystad.)
You are using global wrong. You do not need to use "global loop_valve" in the for loop. The for loop is running in the global context, and any variables created in the for loop are global. You don't declare any variables in Validate() as global, so all the variables are local. w_loop in Validate is not the same variable as w_loop outside Validate().
loop_value has a different problem. loop_value inside Validate() is a local variable. Any changes to loop_valve inside Validate have no effect on loop_valve outoside Validate(). Validate() returns a value, but you don't use the return value anywhere.
And there is another problem that this code:
loop_value has a different problem. loop_value inside Validate() is a local variable. Any changes to loop_valve inside Validate have no effect on loop_valve outoside Validate(). Validate() returns a value, but you don't use the return value anywhere.
And there is another problem that this code:
loop_valve =+1Is the same as
loop_valve = 1Did you mean this:
loop_valve += 1Which is the same as:
loop_valve = loop_valve + 1Why does Validator open a file every time? Does input.txt change? If input.txt changes, why does it change? Are you using a file to communicate between the generator and the validator? Why? Are they different processes?