Aan de slagGa gratis aan de slag

Pop quiz on lambda functions

In this exercise, you will practice writing a simple lambda function and calling this function. Recall what you know about lambda functions and answer the following questions:

  • How would you write a lambda function add_bangs that adds three exclamation points '!!!' to the end of a string a?
  • How would you call add_bangs with the argument 'hello'?

You may use the IPython shell to test your code.

Deze oefening maakt deel uit van de cursus

Introduction to Functions in Python

Cursus bekijken

Praktische interactieve oefening

Zet theorie om in actie met een van onze interactieve oefeningen.

Begin met trainen