From the course: Functional Programming with Python
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Challenge: Converting to list comprehensions - Python Tutorial
From the course: Functional Programming with Python
Challenge: Converting to list comprehensions
(upbeat music) - [Instructor] Now that we've had a lot of practice with Python's functional parts, such as list comprehensions and functions for dealing with iterables, let's do a challenge. The challenge here, to make sure you not only understand how map and filter work but also list comprehensions, is to rewrite the program that we created in a previous video, the program to find the average salary of developers as compared to other professions as we have here. But instead of using the map and filter functions, you're going to do this using list comprehensions. And since there's no good way to recreate the reduce function using list comprehensions, you can either leave this part as reduce or just use Python's built-in sum function. This will probably take you about 10 minutes. Once you've completed it, check out the solution video where I show you how I solved this challenge.
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
(Locked)
Python: The functional parts1m 5s
-
(Locked)
Mapping4m 46s
-
(Locked)
Filtering3m 20s
-
(Locked)
Lambdas in Python4m 25s
-
(Locked)
List comprehensions in Python3m 35s
-
(Locked)
Reducing4m 53s
-
(Locked)
Combining list functions7m 15s
-
(Locked)
Challenge: Converting to list comprehensions52s
-
(Locked)
Solution: Converting to list comprehensions3m 30s
-
(Locked)
-
-