IQLECT interview question

To write a python code