Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ischurov
Last active February 16, 2022 12:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ischurov/21d0818f0be7df2350d2bc11019ba730 to your computer and use it in GitHub Desktop.
Save ischurov/21d0818f0be7df2350d2bc11019ba730 to your computer and use it in GitHub Desktop.
Lesson10
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"metadata": {},
"id": "adult-denmark",
"cell_type": "markdown",
"source": "## Наука о данных\n### Совместный бакалавриат ВШЭ-РЭШ, 2021-2022 учебный год\n_Илья Щуров_\n\n[Страница курса](http://math-info.hse.ru/s21/j)"
},
{
"metadata": {
"trusted": false
},
"id": "genuine-killing",
"cell_type": "code",
"source": "class User:\n def __init__(self, first_name, last_name):\n self.first_name = first_name\n self.last_name = last_name\n self.banned = False\n def __repr__(self):\n return f\"User({self.first_name!r}, {self.last_name!r})\"\n def say_hello(self):\n print(f\"Hello, I'm {self.last_name}. \"\n f\"{self.first_name} {self.last_name}\")",
"execution_count": 16,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "brazilian-internship",
"cell_type": "code",
"source": "\"asd\" \"asdad\"",
"execution_count": 13,
"outputs": [
{
"data": {
"text/plain": "'asdasdad'"
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "shared-event",
"cell_type": "code",
"source": "bond = User(\"James\", \"Bond\")\nbond.say_hello()",
"execution_count": 14,
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": "Hello, I'm Bond. James Bond\n"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "expressed-housing",
"cell_type": "code",
"source": "bond",
"execution_count": 15,
"outputs": [
{
"data": {
"text/plain": "User('James', 'Bond')"
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "integral-holocaust",
"cell_type": "code",
"source": "class Admin(User):\n def __repr__(self):\n return f\"Admin({self.first_name!r}, {self.last_name!r})\"\n \n def ban(self, other):\n other.banned = True\n \n def say_hello(self):\n raise NotImplementedError(\"Admins don't say hello\")",
"execution_count": 35,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "unexpected-scanner",
"cell_type": "code",
"source": "elizabeth = Admin(\"Elizabeth\", \"Smith\")",
"execution_count": 36,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "through-chart",
"cell_type": "code",
"source": "elizabeth",
"execution_count": 37,
"outputs": [
{
"data": {
"text/plain": "Admin('Elizabeth', 'Smith')"
},
"execution_count": 37,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "cloudy-manual",
"cell_type": "code",
"source": "elizabeth.say_hello()",
"execution_count": 38,
"outputs": [
{
"ename": "NotImplementedError",
"evalue": "Admins don't say hello",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mNotImplementedError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-38-58fb9a6de091>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0melizabeth\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msay_hello\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;32m<ipython-input-35-d2e60eae490e>\u001b[0m in \u001b[0;36msay_hello\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 7\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 8\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0msay_hello\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 9\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mNotImplementedError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Admins don't say hello\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;31mNotImplementedError\u001b[0m: Admins don't say hello"
]
}
]
},
{
"metadata": {
"trusted": false
},
"id": "annual-mining",
"cell_type": "code",
"source": "type(elizabeth)",
"execution_count": null,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "reflected-alert",
"cell_type": "code",
"source": "elizabeth.ban(bond)",
"execution_count": 39,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "unique-encoding",
"cell_type": "code",
"source": "bond.banned",
"execution_count": 31,
"outputs": [
{
"data": {
"text/plain": "True"
},
"execution_count": 31,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "banned-browser",
"cell_type": "code",
"source": "type(elizabeth)",
"execution_count": 32,
"outputs": [
{
"data": {
"text/plain": "__main__.Admin"
},
"execution_count": 32,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "united-attachment",
"cell_type": "code",
"source": "isinstance(elizabeth, Admin)",
"execution_count": 33,
"outputs": [
{
"data": {
"text/plain": "True"
},
"execution_count": 33,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "ranking-nomination",
"cell_type": "code",
"source": "isinstance(elizabeth, User)",
"execution_count": 34,
"outputs": [
{
"data": {
"text/plain": "True"
},
"execution_count": 34,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "complicated-ladder",
"cell_type": "code",
"source": "isinstance(True, int)",
"execution_count": 40,
"outputs": [
{
"data": {
"text/plain": "True"
},
"execution_count": 40,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "viral-alaska",
"cell_type": "code",
"source": "isinstance(False, int)",
"execution_count": 41,
"outputs": [
{
"data": {
"text/plain": "True"
},
"execution_count": 41,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "hearing-mechanism",
"cell_type": "code",
"source": "type(True)",
"execution_count": 42,
"outputs": [
{
"data": {
"text/plain": "bool"
},
"execution_count": 42,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "welcome-third",
"cell_type": "code",
"source": "True == 1",
"execution_count": 43,
"outputs": [
{
"data": {
"text/plain": "True"
},
"execution_count": 43,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "solid-update",
"cell_type": "code",
"source": "True + True",
"execution_count": 44,
"outputs": [
{
"data": {
"text/plain": "2"
},
"execution_count": 44,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "matched-identity",
"cell_type": "code",
"source": "True * 1",
"execution_count": 45,
"outputs": [
{
"data": {
"text/plain": "1"
},
"execution_count": 45,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "promising-joining",
"cell_type": "code",
"source": "def divisors(n):\n return [x for x in range(1, n) if n % x == 0]",
"execution_count": 49,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "functioning-david",
"cell_type": "code",
"source": "divisors(100)",
"execution_count": 50,
"outputs": [
{
"data": {
"text/plain": "[1, 2, 4, 5, 10, 20, 25, 50]"
},
"execution_count": 50,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "labeled-azerbaijan",
"cell_type": "code",
"source": "def n_divisors(n):\n return sum([n % x == 0 for x in range(1, n)])",
"execution_count": 53,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "capital-institution",
"cell_type": "code",
"source": "n_divisors(100)",
"execution_count": 54,
"outputs": [
{
"data": {
"text/plain": "8"
},
"execution_count": 54,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "according-remark",
"cell_type": "code",
"source": "n = 100\n[n % x == 0 for x in range(1, n)]",
"execution_count": 55,
"outputs": [
{
"data": {
"text/plain": "[True,\n True,\n False,\n True,\n True,\n False,\n False,\n False,\n False,\n True,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n True,\n False,\n False,\n False,\n False,\n True,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n True,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False]"
},
"execution_count": 55,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "split-salon",
"cell_type": "code",
"source": "issubclass(bool, int)",
"execution_count": 56,
"outputs": [
{
"data": {
"text/plain": "True"
},
"execution_count": 56,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "vital-latvia",
"cell_type": "code",
"source": "issubclass(int, float)",
"execution_count": 57,
"outputs": [
{
"data": {
"text/plain": "False"
},
"execution_count": 57,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "requested-pierre",
"cell_type": "code",
"source": "from dataclasses import dataclass",
"execution_count": 58,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "mexican-console",
"cell_type": "code",
"source": "@dataclass\nclass Point2D:\n x: float\n y: float",
"execution_count": 59,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "conceptual-italic",
"cell_type": "code",
"source": "p1 = Point2D(2, 3)",
"execution_count": 60,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "czech-tuning",
"cell_type": "code",
"source": "p1 = Point2D(y=3, x=2)",
"execution_count": 73,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "confused-benchmark",
"cell_type": "code",
"source": "p1",
"execution_count": 74,
"outputs": [
{
"data": {
"text/plain": "Point2D(x=2, y=3)"
},
"execution_count": 74,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "restricted-booth",
"cell_type": "code",
"source": "from dataclasses import astuple, asdict",
"execution_count": 68,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "usual-cuisine",
"cell_type": "code",
"source": "x, y = astuple(p1)",
"execution_count": 66,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "perfect-tumor",
"cell_type": "code",
"source": "astuple(p1)",
"execution_count": 67,
"outputs": [
{
"data": {
"text/plain": "(2, 3)"
},
"execution_count": 67,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "partial-remark",
"cell_type": "code",
"source": "asdict(p1)",
"execution_count": 69,
"outputs": [
{
"data": {
"text/plain": "{'x': 2, 'y': 3}"
},
"execution_count": 69,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "oriental-cologne",
"cell_type": "code",
"source": "p1.z = 100",
"execution_count": 70,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "moral-savage",
"cell_type": "code",
"source": "p1",
"execution_count": 71,
"outputs": [
{
"data": {
"text/plain": "Point2D(x=2, y=3)"
},
"execution_count": 71,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "worst-sierra",
"cell_type": "code",
"source": "p1.z",
"execution_count": 72,
"outputs": [
{
"data": {
"text/plain": "100"
},
"execution_count": 72,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "wrong-mainland",
"cell_type": "code",
"source": "p1 = Point2D(\"One\", \"Two\")",
"execution_count": 75,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "failing-species",
"cell_type": "code",
"source": "p1",
"execution_count": 76,
"outputs": [
{
"data": {
"text/plain": "Point2D(x='One', y='Two')"
},
"execution_count": 76,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "spiritual-visibility",
"cell_type": "code",
"source": "p = Point2D(1, 2)\np.z = 100",
"execution_count": 78,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "bottom-alias",
"cell_type": "code",
"source": "q = Point2D(3, 4)",
"execution_count": 79,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "demographic-luxembourg",
"cell_type": "code",
"source": "def make_sum(self):\n return self.x + self.y",
"execution_count": 84,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "champion-editing",
"cell_type": "code",
"source": "q.do_sum = lambda: make_sum(self=q)",
"execution_count": 88,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "first-shanghai",
"cell_type": "code",
"source": "q.do_sum()",
"execution_count": 89,
"outputs": [
{
"data": {
"text/plain": "7"
},
"execution_count": 89,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "broad-liechtenstein",
"cell_type": "code",
"source": "p.do_sum()",
"execution_count": 91,
"outputs": [
{
"ename": "AttributeError",
"evalue": "'Point2D' object has no attribute 'do_sum'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-91-144d3c9742d1>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdo_sum\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;31mAttributeError\u001b[0m: 'Point2D' object has no attribute 'do_sum'"
]
}
]
},
{
"metadata": {
"trusted": false
},
"id": "beneficial-virus",
"cell_type": "code",
"source": "my_list = [1, 2, 3]\nother_list = ['a', 'b', 'c']\nz = zip(my_list, other_list)",
"execution_count": 92,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "flexible-accessory",
"cell_type": "code",
"source": "z",
"execution_count": 93,
"outputs": [
{
"data": {
"text/plain": "<zip at 0x7ff3dceaf8c0>"
},
"execution_count": 93,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "smaller-hawaiian",
"cell_type": "code",
"source": "list(z)",
"execution_count": 94,
"outputs": [
{
"data": {
"text/plain": "[(1, 'a'), (2, 'b'), (3, 'c')]"
},
"execution_count": 94,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "spectacular-pulse",
"cell_type": "code",
"source": "list(z)",
"execution_count": 95,
"outputs": [
{
"data": {
"text/plain": "[]"
},
"execution_count": 95,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "historic-illness",
"cell_type": "code",
"source": "class my_iter:\n def __next__(self):\n return 1\n \n def __iter__(self):\n return self",
"execution_count": 97,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "funky-beast",
"cell_type": "code",
"source": "a = my_iter()\ni = 0\nfor element in a:\n print(element)\n i = i + 1\n if i > 10:\n break",
"execution_count": 98,
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": "1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "answering-pressing",
"cell_type": "code",
"source": "class countdown:\n def __init__(self, n):\n self.n = n\n def __next__(self):\n if self.n >= 0:\n self.n = self.n - 1\n return self.n + 1\n else:\n raise StopIteration\n def __iter__(self):\n return self\n \n def show_n(self):\n return self.n",
"execution_count": 109,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "continent-vegetation",
"cell_type": "code",
"source": "wait10 = countdown(10)\nfor x in wait10:\n print(x)",
"execution_count": 110,
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": "10\n9\n8\n7\n6\n5\n4\n3\n2\n1\n0\n"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "curious-logan",
"cell_type": "code",
"source": "wait10.show_n()",
"execution_count": 111,
"outputs": [
{
"data": {
"text/plain": "-1"
},
"execution_count": 111,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "unlikely-sentence",
"cell_type": "code",
"source": "hasattr(wait10, '__next__')",
"execution_count": 113,
"outputs": [
{
"data": {
"text/plain": "True"
},
"execution_count": 113,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "explicit-export",
"cell_type": "code",
"source": "wait10",
"execution_count": 114,
"outputs": [
{
"data": {
"text/plain": "<__main__.countdown at 0x7ff3dd8c0a90>"
},
"execution_count": 114,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "seasonal-feeding",
"cell_type": "code",
"source": "",
"execution_count": 117,
"outputs": [
{
"data": {
"text/plain": "10"
},
"execution_count": 117,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "electronic-allocation",
"cell_type": "code",
"source": "wait10 = countdown(10)\nprint(wait10.n)\nfor x in wait10:\n print(x)\nprint(wait10.n)\nprint(\"Once again\")\nfor x in wait10:\n print(x)",
"execution_count": 120,
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": "10\n10\n9\n8\n7\n6\n5\n4\n3\n2\n1\n0\n-1\nOnce again\n"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "classical-rough",
"cell_type": "code",
"source": "wait10 = countdown(10)\nnext(wait10)",
"execution_count": 121,
"outputs": [
{
"data": {
"text/plain": "10"
},
"execution_count": 121,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "related-direction",
"cell_type": "code",
"source": "wait10.__next__()",
"execution_count": 122,
"outputs": [
{
"data": {
"text/plain": "9"
},
"execution_count": 122,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "static-gates",
"cell_type": "code",
"source": "next(wait10)",
"execution_count": 123,
"outputs": [
{
"data": {
"text/plain": "8"
},
"execution_count": 123,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "clear-montgomery",
"cell_type": "code",
"source": "next(wait10)",
"execution_count": 124,
"outputs": [
{
"data": {
"text/plain": "7"
},
"execution_count": 124,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "conscious-premiere",
"cell_type": "code",
"source": "next(wait10)",
"execution_count": 125,
"outputs": [
{
"data": {
"text/plain": "6"
},
"execution_count": 125,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "forbidden-mixture",
"cell_type": "code",
"source": "next(wait10)",
"execution_count": 132,
"outputs": [
{
"ename": "StopIteration",
"evalue": "",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mStopIteration\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-132-1cff4da80175>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mnext\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mwait10\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;32m<ipython-input-109-a1e947cba261>\u001b[0m in \u001b[0;36m__next__\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 7\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mn\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 8\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 9\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mStopIteration\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 10\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m__iter__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 11\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mStopIteration\u001b[0m: "
]
}
]
},
{
"metadata": {
"trusted": false
},
"id": "acting-turtle",
"cell_type": "code",
"source": "my_list = [1, 2, 10]\nfor x in my_list:\n print(x)\n \nprint(\"Once again\")\nfor x in my_list:\n print(x)\n\n",
"execution_count": 133,
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": "1\n2\n10\nOnce again\n1\n2\n10\n"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "noble-cleaner",
"cell_type": "code",
"source": "my_list.__next__()",
"execution_count": 135,
"outputs": [
{
"ename": "AttributeError",
"evalue": "'list' object has no attribute '__next__'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-135-40b369d77577>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mmy_list\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__next__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;31mAttributeError\u001b[0m: 'list' object has no attribute '__next__'"
]
}
]
},
{
"metadata": {
"trusted": false
},
"id": "athletic-database",
"cell_type": "code",
"source": "my_list",
"execution_count": 137,
"outputs": [
{
"data": {
"text/plain": "[1, 2, 10]"
},
"execution_count": 137,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "homeless-guest",
"cell_type": "code",
"source": "it = my_list.__iter__()",
"execution_count": 138,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "manufactured-evening",
"cell_type": "code",
"source": "next(it)",
"execution_count": 139,
"outputs": [
{
"data": {
"text/plain": "1"
},
"execution_count": 139,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "regulated-acrobat",
"cell_type": "code",
"source": "next(it)",
"execution_count": 140,
"outputs": [
{
"data": {
"text/plain": "2"
},
"execution_count": 140,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "interior-strand",
"cell_type": "code",
"source": "next(it)",
"execution_count": 141,
"outputs": [
{
"data": {
"text/plain": "10"
},
"execution_count": 141,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "separate-blind",
"cell_type": "code",
"source": "next(it)",
"execution_count": 142,
"outputs": [
{
"ename": "StopIteration",
"evalue": "",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mStopIteration\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-142-bc1ab118995a>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mnext\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mit\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;31mStopIteration\u001b[0m: "
]
}
]
},
{
"metadata": {
"trusted": false
},
"id": "desperate-return",
"cell_type": "code",
"source": "my_list",
"execution_count": 143,
"outputs": [
{
"data": {
"text/plain": "[1, 2, 10]"
},
"execution_count": 143,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "amino-illness",
"cell_type": "code",
"source": "it = my_list.__iter__()",
"execution_count": 144,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "cutting-penny",
"cell_type": "code",
"source": "next(it)",
"execution_count": 145,
"outputs": [
{
"data": {
"text/plain": "1"
},
"execution_count": 145,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "packed-insight",
"cell_type": "code",
"source": "it = my_list.__iter__()",
"execution_count": 146,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "alive-masters",
"cell_type": "code",
"source": "next(it)",
"execution_count": 147,
"outputs": [
{
"data": {
"text/plain": "1"
},
"execution_count": 147,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "crazy-spencer",
"cell_type": "code",
"source": "class DebugIterator:\n def __init__(self, n):\n print(\"I'm in __init__, creating new iterator\")\n self.n = n\n def __next__(self):\n print(\"You asked me to get next element\")\n if self.n >= 0:\n self.n = self.n - 1\n return self.n + 1\n else:\n raise StopIteration\n def __iter__(self):\n print(\"I'm in __iter__, returning new iterator\")\n return self\n def show_n(self):\n return self.n",
"execution_count": 149,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "economic-statement",
"cell_type": "code",
"source": "for x in DebugIterator(3):\n print(x)",
"execution_count": 151,
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": "I'm in __init__, creating new iterator\nI'm in __iter__, returning new iterator\nYou asked me to get next element\n3\nYou asked me to get next element\n2\nYou asked me to get next element\n1\nYou asked me to get next element\n0\nYou asked me to get next element\n"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "reported-present",
"cell_type": "code",
"source": "class MyIterable:\n def __iter__(self):\n print(\"Generating new iterator\")\n return DebugIterator(3)",
"execution_count": 155,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "biblical-traveler",
"cell_type": "code",
"source": "my_iterable = MyIterable()\nprint(\"Let's begin\")\nfor x in my_iterable:\n print(x)\nprint(\"Once again\")\nfor x in my_iterable:\n print(x)",
"execution_count": 158,
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": "Let's begin\nGenerating new iterator\nI'm in __init__, creating new iterator\nYou asked me to get next element\n3\nYou asked me to get next element\n2\nYou asked me to get next element\n1\nYou asked me to get next element\n0\nYou asked me to get next element\nOnce again\nGenerating new iterator\nI'm in __init__, creating new iterator\nYou asked me to get next element\n3\nYou asked me to get next element\n2\nYou asked me to get next element\n1\nYou asked me to get next element\n0\nYou asked me to get next element\n"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "reduced-lawrence",
"cell_type": "code",
"source": "list(range(100000000000000))",
"execution_count": 161,
"outputs": [
{
"ename": "MemoryError",
"evalue": "",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mMemoryError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-161-b5ea925078b4>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mlist\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mrange\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m100000000000000\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;31mMemoryError\u001b[0m: "
]
}
]
},
{
"metadata": {
"trusted": false
},
"id": "talented-underground",
"cell_type": "code",
"source": "for x in range(100000000000000):\n y = x * 2",
"execution_count": 162,
"outputs": [
{
"ename": "KeyboardInterrupt",
"evalue": "",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-162-0fbbddc34ced>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mx\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mrange\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m100000000000000\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0my\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mx\u001b[0m \u001b[0;34m*\u001b[0m \u001b[0;36m2\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;31mKeyboardInterrupt\u001b[0m: "
]
}
]
},
{
"metadata": {
"trusted": false
},
"id": "convertible-layer",
"cell_type": "code",
"source": "my_list = [1, 2, 3]\nother_list = ['a', 'b', 'c']\nfor a, b in zip(my_list, other_list):\n print(a, b)\nfor a, b in zip(my_list, other_list):\n print(a, b)\n\n",
"execution_count": 163,
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": "1 a\n2 b\n3 c\n1 a\n2 b\n3 c\n"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "vulnerable-ground",
"cell_type": "code",
"source": "my_list = [1, 2, 3]\nother_list = ['a', 'b', 'c']\nmy_zip = zip(my_list, other_list)\nfor a, b in my_zip:\n print(a, b)\nfor a, b in my_zip:\n print(a, b)",
"execution_count": 165,
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": "1 a\n2 b\n3 c\n"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "intermediate-settle",
"cell_type": "code",
"source": "import itertools",
"execution_count": 166,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "buried-prairie",
"cell_type": "code",
"source": "for x, y in itertools.product(range(3), \"abc\"):\n print(f\"{x} {y}\")",
"execution_count": 167,
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": "0 a\n0 b\n0 c\n1 a\n1 b\n1 c\n2 a\n2 b\n2 c\n"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "criminal-couple",
"cell_type": "code",
"source": "for x in range(3):\n for y in \"abc\":\n print(f\"{x} {y}\")",
"execution_count": 168,
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": "0 a\n0 b\n0 c\n1 a\n1 b\n1 c\n2 a\n2 b\n2 c\n"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "authorized-personality",
"cell_type": "code",
"source": "list(itertools.product(\"abc\", \"abc\", \"abc\"))",
"execution_count": 170,
"outputs": [
{
"data": {
"text/plain": "[('a', 'a', 'a'),\n ('a', 'a', 'b'),\n ('a', 'a', 'c'),\n ('a', 'b', 'a'),\n ('a', 'b', 'b'),\n ('a', 'b', 'c'),\n ('a', 'c', 'a'),\n ('a', 'c', 'b'),\n ('a', 'c', 'c'),\n ('b', 'a', 'a'),\n ('b', 'a', 'b'),\n ('b', 'a', 'c'),\n ('b', 'b', 'a'),\n ('b', 'b', 'b'),\n ('b', 'b', 'c'),\n ('b', 'c', 'a'),\n ('b', 'c', 'b'),\n ('b', 'c', 'c'),\n ('c', 'a', 'a'),\n ('c', 'a', 'b'),\n ('c', 'a', 'c'),\n ('c', 'b', 'a'),\n ('c', 'b', 'b'),\n ('c', 'b', 'c'),\n ('c', 'c', 'a'),\n ('c', 'c', 'b'),\n ('c', 'c', 'c')]"
},
"execution_count": 170,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "jewish-income",
"cell_type": "code",
"source": "list(itertools.permutations(\"abc\"))",
"execution_count": 171,
"outputs": [
{
"data": {
"text/plain": "[('a', 'b', 'c'),\n ('a', 'c', 'b'),\n ('b', 'a', 'c'),\n ('b', 'c', 'a'),\n ('c', 'a', 'b'),\n ('c', 'b', 'a')]"
},
"execution_count": 171,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "ongoing-wilderness",
"cell_type": "code",
"source": "list(itertools.combinations(range(10), 3))",
"execution_count": 173,
"outputs": [
{
"data": {
"text/plain": "[(0, 1, 2),\n (0, 1, 3),\n (0, 1, 4),\n (0, 1, 5),\n (0, 1, 6),\n (0, 1, 7),\n (0, 1, 8),\n (0, 1, 9),\n (0, 2, 3),\n (0, 2, 4),\n (0, 2, 5),\n (0, 2, 6),\n (0, 2, 7),\n (0, 2, 8),\n (0, 2, 9),\n (0, 3, 4),\n (0, 3, 5),\n (0, 3, 6),\n (0, 3, 7),\n (0, 3, 8),\n (0, 3, 9),\n (0, 4, 5),\n (0, 4, 6),\n (0, 4, 7),\n (0, 4, 8),\n (0, 4, 9),\n (0, 5, 6),\n (0, 5, 7),\n (0, 5, 8),\n (0, 5, 9),\n (0, 6, 7),\n (0, 6, 8),\n (0, 6, 9),\n (0, 7, 8),\n (0, 7, 9),\n (0, 8, 9),\n (1, 2, 3),\n (1, 2, 4),\n (1, 2, 5),\n (1, 2, 6),\n (1, 2, 7),\n (1, 2, 8),\n (1, 2, 9),\n (1, 3, 4),\n (1, 3, 5),\n (1, 3, 6),\n (1, 3, 7),\n (1, 3, 8),\n (1, 3, 9),\n (1, 4, 5),\n (1, 4, 6),\n (1, 4, 7),\n (1, 4, 8),\n (1, 4, 9),\n (1, 5, 6),\n (1, 5, 7),\n (1, 5, 8),\n (1, 5, 9),\n (1, 6, 7),\n (1, 6, 8),\n (1, 6, 9),\n (1, 7, 8),\n (1, 7, 9),\n (1, 8, 9),\n (2, 3, 4),\n (2, 3, 5),\n (2, 3, 6),\n (2, 3, 7),\n (2, 3, 8),\n (2, 3, 9),\n (2, 4, 5),\n (2, 4, 6),\n (2, 4, 7),\n (2, 4, 8),\n (2, 4, 9),\n (2, 5, 6),\n (2, 5, 7),\n (2, 5, 8),\n (2, 5, 9),\n (2, 6, 7),\n (2, 6, 8),\n (2, 6, 9),\n (2, 7, 8),\n (2, 7, 9),\n (2, 8, 9),\n (3, 4, 5),\n (3, 4, 6),\n (3, 4, 7),\n (3, 4, 8),\n (3, 4, 9),\n (3, 5, 6),\n (3, 5, 7),\n (3, 5, 8),\n (3, 5, 9),\n (3, 6, 7),\n (3, 6, 8),\n (3, 6, 9),\n (3, 7, 8),\n (3, 7, 9),\n (3, 8, 9),\n (4, 5, 6),\n (4, 5, 7),\n (4, 5, 8),\n (4, 5, 9),\n (4, 6, 7),\n (4, 6, 8),\n (4, 6, 9),\n (4, 7, 8),\n (4, 7, 9),\n (4, 8, 9),\n (5, 6, 7),\n (5, 6, 8),\n (5, 6, 9),\n (5, 7, 8),\n (5, 7, 9),\n (5, 8, 9),\n (6, 7, 8),\n (6, 7, 9),\n (6, 8, 9),\n (7, 8, 9)]"
},
"execution_count": 173,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "fitted-destination",
"cell_type": "code",
"source": "for x in itertools.count():\n print(x)\n if x > 10:\n break",
"execution_count": 175,
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "organizational-iraqi",
"cell_type": "code",
"source": "list(itertools.islice(itertools.count(), 3, 14))",
"execution_count": 177,
"outputs": [
{
"data": {
"text/plain": "[3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]"
},
"execution_count": 177,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "digital-potential",
"cell_type": "code",
"source": "def n_divisors(n):\n return sum(n % x == 0 for x in range(1, n))",
"execution_count": 179,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "blocked-rebecca",
"cell_type": "code",
"source": "n_divisors(100)",
"execution_count": 180,
"outputs": [
{
"data": {
"text/plain": "8"
},
"execution_count": 180,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "hourly-onion",
"cell_type": "code",
"source": "n = 100\nsum(n % x == 0 for x in range(1, n))",
"execution_count": 181,
"outputs": [
{
"data": {
"text/plain": "8"
},
"execution_count": 181,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "competent-transcription",
"cell_type": "code",
"source": "[n % x == 0 for x in range(1, n)]",
"execution_count": 186,
"outputs": [
{
"data": {
"text/plain": "[True,\n True,\n False,\n True,\n True,\n False,\n False,\n False,\n False,\n True,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n True,\n False,\n False,\n False,\n False,\n True,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n True,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False,\n False]"
},
"execution_count": 186,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "extended-tulsa",
"cell_type": "code",
"source": "divisors_it = (n % x == 0 for x in range(1, n))",
"execution_count": 182,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "thermal-brunswick",
"cell_type": "code",
"source": "type(divisors_it)",
"execution_count": 183,
"outputs": [
{
"data": {
"text/plain": "generator"
},
"execution_count": 183,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "critical-regression",
"cell_type": "code",
"source": "divisors_it.__next__()",
"execution_count": 184,
"outputs": [
{
"data": {
"text/plain": "True"
},
"execution_count": 184,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "iraqi-finder",
"cell_type": "code",
"source": "sum(divisors_it)",
"execution_count": 185,
"outputs": [
{
"data": {
"text/plain": "7"
},
"execution_count": 185,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "worldwide-finder",
"cell_type": "code",
"source": "my_list = [-4, -2, -3, 10, 4, -3, 4, ]",
"execution_count": 189,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "fifty-walnut",
"cell_type": "code",
"source": "for x in my_list:\n if x > 0:\n print(x)\n break",
"execution_count": 190,
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": "10\n"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "mediterranean-personal",
"cell_type": "code",
"source": "next((x for x in my_list if x > 0))",
"execution_count": 193,
"outputs": [
{
"data": {
"text/plain": "10"
},
"execution_count": 193,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "anticipated-transition",
"cell_type": "code",
"source": "max(range(100000000))",
"execution_count": 198,
"outputs": [
{
"data": {
"text/plain": "99999999"
},
"execution_count": 198,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "oriental-cedar",
"cell_type": "code",
"source": "x = 12\ns = \"Hello\"\nf\"x = {x}, and the string is {s}\"",
"execution_count": 199,
"outputs": [
{
"data": {
"text/plain": "'x = 12, and the string is Hello'"
},
"execution_count": 199,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "sticky-chance",
"cell_type": "code",
"source": "",
"execution_count": null,
"outputs": []
}
],
"metadata": {
"_draft": {
"nbviewer_url": "https://gist.github.com/21d0818f0be7df2350d2bc11019ba730"
},
"gist": {
"id": "21d0818f0be7df2350d2bc11019ba730",
"data": {
"description": "Lesson10",
"public": false
}
},
"kernelspec": {
"name": "py39_system",
"display_name": "Python 3.9 (system)",
"language": "python"
},
"language_info": {
"name": "python",
"version": "3.9.0",
"mimetype": "text/x-python",
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"pygments_lexer": "ipython3",
"nbconvert_exporter": "python",
"file_extension": ".py"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment