Siemens Interview Question

Implement a counter in python