Python Functional Programming For Problem