Cognizant Interview Question

Write a python code and explain it