← Back to challenges

All About Lambda Expressions: Adding Suffixes

PythonHardlanguage_fundamentalsclosureshigher_order_functions

Instructions

Write a function that returns a lambda expression, which transforms its input by adding a particular suffix at the end.

Examples

add_ly = add_suffix("ly")

add_ly("hopeless") ➞ "hopelessly"
add_ly("total") ➞ "totally"

add_less = add_suffix("less")

add_less("fear") ➞ "fearless"
add_less("ruth") ➞ "ruthless"

Notes

N/A

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Emphasise the Words