1. Learn
  2. /
  3. Courses
  4. /
  5. Intermediate Python for Developers

Connected

Exercise

Calculating file sizes

Lambda functions are handy for quickly creating short, one-line functions that can be used immediately without the need for formal def definitions.

In this exercise, you'll work with a lambda function that calculates the total file size including extra space needed for file information. extra_space is calculated as a percent of file_size.

Instructions

100 XP
  • Define the calculate_total lambda that adds the extra_space to the base file size.
  • Call calculate_total() on the file_size variable.