Exercise

Define lambda expressions

Let's write some lambda expressions! You will be given three tasks: each will require you to define a lambda expression taking some values as arguments and using them to calculate a specific result.

Instructions 1/3

undefined XP
  • 1

    Take \(x\) and return \(x^2\) if \(x > 0\) and \(0\), otherwise.

  • 2

    Take a list of integers nums and leave only even numbers.

  • 3

    Take strings s1, s2 and list their common characters.