May-25-2022, 03:05 PM
(This post was last modified: May-25-2022, 03:08 PM by Gribouillis.)
(May-25-2022, 02:31 PM)Mark17 Wrote: I'm thinking about creating a user-defined function where the variables common to all three places are reset to 0.This is why classes were invented: to group in a single entity variables shared by different places. So create a class (or several classes) to hold the variables
class Foo: def __init__(self): self.reset() def reset(self): self.baz = 10 self.bar = 'hello' self.spam = 3.14159 foo = Foo() ... ... if ...: ... foo.reset()