ΣνΜDr. Sharon's Math PlatformSyvara Learning
Question Bank › 📘 Undergraduate › Programming for Engineers › Q7

Q7 · (a) Define a lambda function called square that takes one argument and returns its…

Functions 🟢 Intro Coding
Question

(a) Define a lambda function called square that takes one argument and returns its square. Test with inputs 2 and 5.
(b) Write an equivalent named function square_fn(x) using def. Verify both give the same results.
(c) Define a lambda function my_adder that takes two arguments x and y and returns their sum. Test with my_adder(2, 4).

🔒

Log in to see the worked solution

Enter your email to get started. Your first free solutions in every course unlock as soon as you verify.

Log in or sign up with email
← Previous Next →
Working…