Practice Mapping Functions To New Names (24.4.2) - Function definitions
Students

Academic Programs

AI-powered learning for grades 8-12, aligned with major curricula

Professional

Professional Courses

Industry-relevant training in Business, Technology, and Design

Games

Interactive Games

Fun games to boost memory, math, typing, and English skills

Mapping Functions to New Names

Practice - Mapping Functions to New Names

Learning

Practice Questions

Test your understanding with targeted questions

Question 1 Easy

What is the result of calling g = f, if f() returns 5, and g() is then executed?

💡 Hint: Think about what `f` represents after the assignment.

Question 2 Easy

Define a function named identity that returns its input.

💡 Hint: Remember the simplest form of a function!

4 more questions available

Interactive Quizzes

Quick quizzes to reinforce your learning

Question 1

What is the result of mapping function f to g?

g becomes a new function
g cannot be used
g is a reference to f

💡 Hint: Consider what happens when two names reference the same object.

Question 2

True or False: Functions cannot be assigned to variables in Python.

True
False

💡 Hint: Think of how variables can hold different types.

Get performance evaluation

Challenge Problems

Push your limits with advanced challenges

Challenge 1 Hard

Create a function that accepts a function and a list and returns a new list where each element has been transformed by the passed function.

💡 Hint: Utilize list comprehension to streamline your solution.

Challenge 2 Hard

Write a function that sorts a list of strings first by length, then alphabetically.

💡 Hint: Consider using a tuple in the key for multi-criteria sorting.

Get performance evaluation

Reference links

Supplementary resources to enhance your learning experience.