TeamViewer Interview Question

Coding task to implement in python