DXC Technology Interview Question

write a function in python