diff --git a/higher_order_functions.ipynb b/higher_order_functions.ipynb
deleted file mode 100644
index 6bc53c7..0000000
--- a/higher_order_functions.ipynb
+++ /dev/null
@@ -1,167 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "## map function\n",
- "this is used to apply a function to all the items in an iterable and returns the mapped object
\n",
- "syntax: map_object map(function_name, iterable)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 1,
- "metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "list1: [1, 2, 3, 4, 5]\n",
- "list2: [6, 7, 8, 9, 10]\n"
- ]
- }
- ],
- "source": [
- "list1 = [1, 2, 3, 4, 5]\n",
- "list2 = list(map(lambda x: x + 5, list1))\n",
- "print(\"list1:\", list1)\n",
- "print(\"list2:\", list2)"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "## filter function\n",
- "this is used to filter the values in an iterable according to a condition and returns an iterable with new set of items which satisfied the condition
\n",
- "syntax: filter_object filter(function_name, iterable)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 2,
- "metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "list1: [1, 2, 3, 4, 5]\n",
- "list2: [3, 4, 5]\n"
- ]
- }
- ],
- "source": [
- "list1 = [1, 2, 3, 4, 5]\n",
- "list2 = list(filter(lambda x: x>=3, list1))\n",
- "print(\"list1:\", list1)\n",
- "print(\"list2:\", list2)"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "## reduce function\n",
- "this is used to reduce an iterable to a single value based of all the values
\n",
- "syntax: reduced_value reduce(function_name, iterable)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 4,
- "metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "list1: [1, 2, 3, 4, 5]\n",
- "reduced_value: 15\n"
- ]
- }
- ],
- "source": [
- "from functools import reduce\n",
- "list1 = [1, 2, 3, 4, 5]\n",
- "reduced_value = reduce(lambda x,y: x+y, list1)\n",
- "print(\"list1:\", list1)\n",
- "print(\"reduced_value:\", reduced_value)"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "## examples"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 5,
- "metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "list1: [1, 2, 3, 4, 5]\n",
- "list2: [2, 4]\n"
- ]
- }
- ],
- "source": [
- "# find even numbers\n",
- "list1 = [1, 2, 3, 4, 5]\n",
- "list2 = list(filter(lambda x: x%2==0, list1))\n",
- "print(\"list1:\", list1)\n",
- "print(\"list2:\", list2)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 6,
- "metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "list1: [1, 2, 3, 4, 5]\n",
- "reduced_value: 1\n"
- ]
- }
- ],
- "source": [
- "# find min of elements\n",
- "list1 = [1, 2, 3, 4, 5]\n",
- "min_val = reduce(lambda x,y: x if x < y else y, list1)\n",
- "print(\"list1:\", list1)\n",
- "print(\"reduced_value:\", min_val)"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 3",
- "language": "python",
- "name": "python3"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 3
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython3",
- "version": "3.6.8"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 2
-}