/map-filter-reduce-workshop

Workshop with some programming issues that needed to be solved in a functional way

Primary LanguagePython

map-filter-reduce-workshop

Workshop with some programming issues that needed to be solved in a functional way

Exercises

  1. Write a program which can map() to make a list whose elements are square of elements in [1,2,3,4,5,6,7,8,9,10].

  2. Write a program which can map() and filter() to make a list whose elements are square of even number in [1,2,3,4,5,6,7,8,9,10].

  3. Write a program which can filter() to make a list whose elements are even number between 1 and 20 (both included).

  4. Write a program which can map() to make a list whose elements are square of numbers between 1 and 20 (both included).

  5. Determine the maximum of a list of numerical values by using reduce.

  6. Calculate the sum of the numbers from 1 to 100, use reduce.

  7. Change the previous example to calculate the product (the factorial) from 1 to a number, but do not choose 50.

  8. Write a Python program to filter the positive numbers from a list.

  9. Find the intersection of two lists, using filter.