from time import sleep
class FooBar:
def __init__(self, n):
self.n = n
self.next = "foo"
def foo(self, printFoo: 'Callable[[], None]') -> None:
for i in range(self.n):
while self.next != "foo":
sleep(0.001)
# printFoo() outputs "foo". Do not change or remove this line.
printFoo()
self.next = "bar"
def bar(self, printBar: 'Callable[[], None]') -> None:
for i in range(self.n):
while self.next != "bar":
sleep(0.001)
# printBar() outputs "bar". Do not change or remove this line.
printBar()
self.next = "foo"