Siemens interview question

Implement a counter in python