{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "# Not On Exam 01"
      ],
      "id": "336eb11c-af03-4251-8100-dc4d79f9e416"
    },
    {
      "cell_type": "code",
      "execution_count": 17,
      "metadata": {},
      "outputs": [],
      "source": [
        "class Container():\n",
        "    def __init__(self, *x):\n",
        "        self._data = [*x]\n",
        "\n",
        "    def push_back(self, x):\n",
        "        self._data.append(x)\n",
        "\n",
        "    def __len__(self):\n",
        "        return len(self._data)"
      ],
      "id": "f7576776-959b-4306-8232-24c3daf9ef39"
    },
    {
      "cell_type": "code",
      "execution_count": 18,
      "metadata": {},
      "outputs": [
        {
          "output_type": "display_data",
          "metadata": {},
          "data": {
            "text/plain": [
              "[1, 2, 3, 4, 5, 6, 7, 8, 'math314', 9, 'another']"
            ]
          }
        }
      ],
      "source": [
        "c = Container(1, 2, 3, 4, 5, 6, 7, 8, \"math314\", 9)\n",
        "c.push_back(\"another\")\n",
        "c._data"
      ],
      "id": "9b192eee-d254-4700-9738-130c32d8d477"
    },
    {
      "cell_type": "code",
      "execution_count": 19,
      "metadata": {},
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "something"
          ]
        }
      ],
      "source": [
        "if c:\n",
        "    print(\"something\")"
      ],
      "id": "5c82a6c1-64bd-47c3-b6a3-76269a722f51"
    },
    {
      "cell_type": "code",
      "execution_count": 20,
      "metadata": {},
      "outputs": [
        {
          "output_type": "display_data",
          "metadata": {},
          "data": {
            "text/plain": [
              "[]"
            ]
          }
        }
      ],
      "source": [
        "c2 = Container()\n",
        "c2._data"
      ],
      "id": "8e8d541b-fc14-447a-9cab-ec95e59507d0"
    },
    {
      "cell_type": "code",
      "execution_count": 21,
      "metadata": {},
      "outputs": [],
      "source": [
        "if c2:\n",
        "    print(\"something\")"
      ],
      "id": "6e42a000-7d34-4f81-84f2-9d460a7953eb"
    },
    {
      "cell_type": "code",
      "execution_count": 22,
      "metadata": {},
      "outputs": [
        {
          "output_type": "display_data",
          "metadata": {},
          "data": {
            "text/plain": [
              "0"
            ]
          }
        }
      ],
      "source": [
        "[].__len__()"
      ],
      "id": "2f2056df-476f-43d9-9d7e-6f52598337a7"
    },
    {
      "cell_type": "code",
      "execution_count": 23,
      "metadata": {},
      "outputs": [
        {
          "output_type": "display_data",
          "metadata": {},
          "data": {
            "text/plain": [
              "0"
            ]
          }
        }
      ],
      "source": [
        "\"\".__len__()"
      ],
      "id": "4401c03c-725e-4b9b-b790-09d2b30d1214"
    },
    {
      "cell_type": "code",
      "execution_count": 24,
      "metadata": {},
      "outputs": [
        {
          "output_type": "display_data",
          "metadata": {},
          "data": {
            "text/plain": [
              "0"
            ]
          }
        }
      ],
      "source": [
        "{}.__len__()"
      ],
      "id": "5ed67d26-e060-476b-9381-6690fe689a76"
    },
    {
      "cell_type": "code",
      "execution_count": 25,
      "metadata": {},
      "outputs": [],
      "source": [
        "def f(x, y, z, **kwargs):\n",
        "    if \"key\" in kwargs:\n",
        "        return kwargs[\"key\"]\n",
        "    return x + y + z"
      ],
      "id": "39ee6bb4-8eff-478c-8e0a-e87cac58da2d"
    },
    {
      "cell_type": "code",
      "execution_count": 26,
      "metadata": {},
      "outputs": [
        {
          "output_type": "display_data",
          "metadata": {},
          "data": {
            "text/plain": [
              "'cool'"
            ]
          }
        }
      ],
      "source": [
        "f(1, 2, 3, edward = \"math314\", another = 10, key = \"cool\")"
      ],
      "id": "1e92fc43-5101-4401-8162-ceb29b742e54"
    },
    {
      "cell_type": "code",
      "execution_count": 27,
      "metadata": {},
      "outputs": [
        {
          "output_type": "display_data",
          "metadata": {},
          "data": {
            "text/plain": [
              "6"
            ]
          }
        }
      ],
      "source": [
        "f(1, 2, 3)"
      ],
      "id": "172f36d9-6dce-47d1-9d84-99a6da6bd86c"
    }
  ],
  "nbformat": 4,
  "nbformat_minor": 5,
  "metadata": {
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3 (ipykernel)",
      "language": "python"
    },
    "language_info": {
      "name": "python",
      "codemirror_mode": {
        "name": "ipython",
        "version": "3"
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.12.12"
    }
  }
}