Netradyne Interview Question

Python code for an usecase