DXC Technology interview question

write a function in python