Program - custom logging along with counter


Topic: Program - custom logging along with counter

Solution

def custom_counter_log():
    """
    An implementation of closures
    """
    x = 0
    dt = datetime.now()
    def inner():
       nonlocal x
       x += 1
       print(f' Switch or button is called {x} at {dt}')
     return inner



List all Python Programs