How To Create A Python Function For The Below Requirement Stack Overflow

How To Create A Python Function For The Below Requirement Stack Overflow