Netradyne interview question

Python code for an usecase