Functional programming (FP) is a programming style emphasizing functions that return consistent and predictable results regardless of a program's state. …