Добавлены примеры и задание по типам коллекций

This commit is contained in:
Sergey Lemeshevsky
2020-03-09 14:33:15 +03:00
parent 2756a9b834
commit 7dba740376
15 changed files with 2151 additions and 107 deletions

1
.gitignore vendored
View File

@@ -1 +1,2 @@
/.ipynb_checkpoints/*.ipynb /.ipynb_checkpoints/*.ipynb
Untitled.ipynb

656
Untitled.ipynb Normal file
View File

@@ -0,0 +1,656 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stdin",
"output_type": "stream",
"text": [
" 10\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"100\n"
]
}
],
"source": [
"%run src-intro/test.py"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'/home/svl/Projects/Doconce/python-course/ipynb'"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"%pwd"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"/home/svl/Projects/Doconce/python-course/ipynb/src-intro\n"
]
}
],
"source": [
"%cd src-intro"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Hello from Python!\n"
]
}
],
"source": [
"%run hello.py"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n"
]
}
],
"source": [
"%run fib.py"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"range(0, 5)"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"range(5)"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<generator object <genexpr> at 0x7f65857f9c80>\n"
]
}
],
"source": [
"print(i for i in range(5))"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"\u001b[0;31mInit signature:\u001b[0m \u001b[0mrange\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[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mDocstring:\u001b[0m \n",
"range(stop) -> range object\n",
"range(start, stop[, step]) -> range object\n",
"\n",
"Return an object that produces a sequence of integers from start (inclusive)\n",
"to stop (exclusive) by step. range(i, j) produces i, i+1, i+2, ..., j-1.\n",
"start defaults to 0, and stop is omitted! range(4) produces 0, 1, 2, 3.\n",
"These are exactly the valid indices for a list of 4 elements.\n",
"When step is given, it specifies the increment (or decrement).\n",
"\u001b[0;31mType:\u001b[0m type\n",
"\u001b[0;31mSubclasses:\u001b[0m \n"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"range?"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[10, 8, 6, 4, 2]"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"list(range(10,1, -2))"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[1, 1, 2, 3, 5, 8, 13, 21, 34, 55]\n"
]
}
],
"source": [
"%run fib.py"
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {},
"outputs": [
{
"ename": "TypeError",
"evalue": "can't multiply sequence by non-int of type 'float'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-25-da4664af34ee>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mfib\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m1.0\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~/Projects/Doconce/python-course/ipynb/src-intro/fib.py\u001b[0m in \u001b[0;36mfib\u001b[0;34m(n)\u001b[0m\n\u001b[1;32m 5\u001b[0m \"\"\"\n\u001b[1;32m 6\u001b[0m \u001b[0mf0\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mf1\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;36m0\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[0;32m----> 7\u001b[0;31m \u001b[0mf\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mn\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 8\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mi\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mrange\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mn\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 9\u001b[0m \u001b[0mf\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mi\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mf0\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0mf1\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mTypeError\u001b[0m: can't multiply sequence by non-int of type 'float'"
]
}
],
"source": [
"fib(1.0)"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"> \u001b[0;32m/home/svl/Projects/Doconce/python-course/ipynb/src-intro/fib.py\u001b[0m(7)\u001b[0;36mfib\u001b[0;34m()\u001b[0m\n",
"\u001b[0;32m 5 \u001b[0;31m \"\"\"\n",
"\u001b[0m\u001b[0;32m 6 \u001b[0;31m \u001b[0mf0\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mf1\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;36m0\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[0m\u001b[0;32m----> 7 \u001b[0;31m \u001b[0mf\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mn\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0m\u001b[0;32m 8 \u001b[0;31m \u001b[0;32mfor\u001b[0m \u001b[0mi\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mrange\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mn\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 9 \u001b[0;31m \u001b[0mf\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mi\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mf0\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0mf1\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0m\n"
]
},
{
"name": "stdin",
"output_type": "stream",
"text": [
"ipdb> f\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"*** NameError: name 'f' is not defined\n"
]
},
{
"name": "stdin",
"output_type": "stream",
"text": [
"ipdb> f01\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"*** NameError: name 'f01' is not defined\n"
]
},
{
"name": "stdin",
"output_type": "stream",
"text": [
"ipdb> f0\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"0\n"
]
},
{
"name": "stdin",
"output_type": "stream",
"text": [
"ipdb> f1\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"1\n"
]
},
{
"name": "stdin",
"output_type": "stream",
"text": [
"ipdb> n\n"
]
}
],
"source": [
"%debug"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[1]"
]
},
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[1, 1, 1, 1]"
]
},
"execution_count": 24,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a*4"
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[1]"
]
},
"execution_count": 27,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a"
]
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[1, 1, 2]"
]
},
"execution_count": 28,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"fib(3)"
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {},
"outputs": [
{
"name": "stdin",
"output_type": "stream",
"text": [
"Once deleted, variables cannot be recovered. Proceed (y/[n])? y\n"
]
}
],
"source": [
"%reset"
]
},
{
"cell_type": "code",
"execution_count": 30,
"metadata": {},
"outputs": [
{
"ename": "NameError",
"evalue": "name 'a' is not defined",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-30-3f786850e387>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0ma\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;31mNameError\u001b[0m: name 'a' is not defined"
]
}
],
"source": [
"a"
]
},
{
"cell_type": "code",
"execution_count": 31,
"metadata": {},
"outputs": [
{
"ename": "NameError",
"evalue": "name 'fib' is not defined",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-31-252d5fa3ed3f>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mfib\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m4\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;31mNameError\u001b[0m: name 'fib' is not defined"
]
}
],
"source": [
"fib(4)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 32,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[1, 1, 2, 3, 5, 8, 13, 21, 34, 55]\n"
]
}
],
"source": [
"%run fib.py"
]
},
{
"cell_type": "code",
"execution_count": 33,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"8.35 µs ± 194 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)\n"
]
}
],
"source": [
"%timeit fib(100)"
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"CPU times: user 84 µs, sys: 0 ns, total: 84 µs\n",
"Wall time: 98.5 µs\n"
]
}
],
"source": [
"result = %time fib(100)"
]
},
{
"cell_type": "code",
"execution_count": 35,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[1,\n",
" 1,\n",
" 2,\n",
" 3,\n",
" 5,\n",
" 8,\n",
" 13,\n",
" 21,\n",
" 34,\n",
" 55,\n",
" 89,\n",
" 144,\n",
" 233,\n",
" 377,\n",
" 610,\n",
" 987,\n",
" 1597,\n",
" 2584,\n",
" 4181,\n",
" 6765,\n",
" 10946,\n",
" 17711,\n",
" 28657,\n",
" 46368,\n",
" 75025,\n",
" 121393,\n",
" 196418,\n",
" 317811,\n",
" 514229,\n",
" 832040,\n",
" 1346269,\n",
" 2178309,\n",
" 3524578,\n",
" 5702887,\n",
" 9227465,\n",
" 14930352,\n",
" 24157817,\n",
" 39088169,\n",
" 63245986,\n",
" 102334155,\n",
" 165580141,\n",
" 267914296,\n",
" 433494437,\n",
" 701408733,\n",
" 1134903170,\n",
" 1836311903,\n",
" 2971215073,\n",
" 4807526976,\n",
" 7778742049,\n",
" 12586269025,\n",
" 20365011074,\n",
" 32951280099,\n",
" 53316291173,\n",
" 86267571272,\n",
" 139583862445,\n",
" 225851433717,\n",
" 365435296162,\n",
" 591286729879,\n",
" 956722026041,\n",
" 1548008755920,\n",
" 2504730781961,\n",
" 4052739537881,\n",
" 6557470319842,\n",
" 10610209857723,\n",
" 17167680177565,\n",
" 27777890035288,\n",
" 44945570212853,\n",
" 72723460248141,\n",
" 117669030460994,\n",
" 190392490709135,\n",
" 308061521170129,\n",
" 498454011879264,\n",
" 806515533049393,\n",
" 1304969544928657,\n",
" 2111485077978050,\n",
" 3416454622906707,\n",
" 5527939700884757,\n",
" 8944394323791464,\n",
" 14472334024676221,\n",
" 23416728348467685,\n",
" 37889062373143906,\n",
" 61305790721611591,\n",
" 99194853094755497,\n",
" 160500643816367088,\n",
" 259695496911122585,\n",
" 420196140727489673,\n",
" 679891637638612258,\n",
" 1100087778366101931,\n",
" 1779979416004714189,\n",
" 2880067194370816120,\n",
" 4660046610375530309,\n",
" 7540113804746346429,\n",
" 12200160415121876738,\n",
" 19740274219868223167,\n",
" 31940434634990099905,\n",
" 51680708854858323072,\n",
" 83621143489848422977,\n",
" 135301852344706746049,\n",
" 218922995834555169026,\n",
" 354224848179261915075]"
]
},
"execution_count": 35,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"result"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"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.8.1"
}
},
"nbformat": 4,
"nbformat_minor": 4
}

File diff suppressed because it is too large Load Diff

View File

@@ -10,7 +10,7 @@
"<!-- Author: --> \n", "<!-- Author: --> \n",
"**С.В. Лемешевский** (email: `sergey.lemeshevsky@gmail.com`), Институт математики НАН Беларуси\n", "**С.В. Лемешевский** (email: `sergey.lemeshevsky@gmail.com`), Институт математики НАН Беларуси\n",
"\n", "\n",
"Date: **Feb 27, 2020**\n", "Date: **Mar 4, 2020**\n",
"\n", "\n",
"<!-- Common Mako variable and functions -->\n", "<!-- Common Mako variable and functions -->\n",
"<!-- -*- coding: utf-8 -*- -->\n", "<!-- -*- coding: utf-8 -*- -->\n",
@@ -1806,7 +1806,7 @@
"преобразуется к верхнему регистру, а остальные символы к нижнему. \n", "преобразуется к верхнему регистру, а остальные символы к нижнему. \n",
"\n", "\n",
"\n", "\n",
"## `quadratic.py`\n", "## Решение квадратного уравнения\n",
"<div id=\"datatype:examples:quadratic\"></div>\n", "<div id=\"datatype:examples:quadratic\"></div>\n",
"\n", "\n",
"Квадратные уравнения это уравнения вида $ax^2 + bx + c = 0$, где $a \\ne 0$,\n", "Квадратные уравнения это уравнения вида $ax^2 + bx + c = 0$, где $a \\ne 0$,\n",
@@ -1845,8 +1845,27 @@
"С коэффициентами $1.5$, $-3$ и $6$ программа выведет (некоторые цифры\n", "С коэффициентами $1.5$, $-3$ и $6$ программа выведет (некоторые цифры\n",
"обрезаны):\n", "обрезаны):\n",
"\n", "\n",
"Теперь обратимся к программному коду, который начинается тремя инструкциями `import`:\n", "Теперь обратимся к [программному коду](src-datatype/quadratic.py),\n",
"\n", "который начинается тремя инструкциями `import`:"
]
},
{
"cell_type": "code",
"execution_count": 54,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"import cmath\n",
"import math\n",
"import sys"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Нам необходимы обе математические библиотеки для работы с числами типа\n", "Нам необходимы обе математические библиотеки для работы с числами типа\n",
"`float` и `complex`, так как функции, вычисляющие квадратный \n", "`float` и `complex`, так как функции, вычисляющие квадратный \n",
"корень из вещественных и комплексных чисел, отличаются. Модуль\n", "корень из вещественных и комплексных чисел, отличаются. Модуль\n",
@@ -1860,13 +1879,12 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 54, "execution_count": 55,
"metadata": { "metadata": {
"collapsed": false "collapsed": false
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
"# Start get_float\n",
"def get_float(msg, allow_zero):\n", "def get_float(msg, allow_zero):\n",
" x = None\n", " x = None\n",
" while x is None:\n", " while x is None:\n",
@@ -1895,13 +1913,12 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 55, "execution_count": 56,
"metadata": { "metadata": {
"collapsed": false "collapsed": false
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
"# Start 1st block\n",
"print(\"ax\\N{SUPERSCRIPT TWO} + bx + c = 0\")\n", "print(\"ax\\N{SUPERSCRIPT TWO} + bx + c = 0\")\n",
"a = get_float(\"enter a: \", False)\n", "a = get_float(\"enter a: \", False)\n",
"b = get_float(\"enter b: \", False)\n", "b = get_float(\"enter b: \", False)\n",
@@ -1919,13 +1936,12 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 56, "execution_count": 57,
"metadata": { "metadata": {
"collapsed": false "collapsed": false
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
"# Start 2d block\n",
"x1 = None\n", "x1 = None\n",
"x2 = None\n", "x2 = None\n",
"discriminant = (b ** 2) - (4 * a * c)\n", "discriminant = (b ** 2) - (4 * a * c)\n",
@@ -1954,13 +1970,12 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 57, "execution_count": 58,
"metadata": { "metadata": {
"collapsed": false "collapsed": false
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
"# Start 3d block\n",
"equation = (\"{0}x\\N{SUPERSCRIPT TWO} + {1}x + {2} = 0\"\n", "equation = (\"{0}x\\N{SUPERSCRIPT TWO} + {1}x + {2} = 0\"\n",
" \" \\N{RIGHTWARDS ARROW} x = {3}\").format(a, b, c, x1)\n", " \" \\N{RIGHTWARDS ARROW} x = {3}\").format(a, b, c, x1)\n",
"if x2 is not None:\n", "if x2 is not None:\n",
@@ -1978,7 +1993,7 @@
"использовали некоторые имена Юникода для вывода пары специальных\n", "использовали некоторые имена Юникода для вывода пары специальных\n",
"символов.\n", "символов.\n",
"\n", "\n",
"## `csv2html.py`\n", "## Представление таблицы `csv` в HTML\n",
"<div id=\"datatype:examples:csv2html\"></div>\n", "<div id=\"datatype:examples:csv2html\"></div>\n",
"\n", "\n",
"Часто бывает необходимо представить данные в формате HTML. В этом\n", "Часто бывает необходимо представить данные в формате HTML. В этом\n",
@@ -2018,8 +2033,7 @@
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
"Предположим, что данные находятся в файле\n", "Предположим, что данные находятся в файле [sample.csv](src-datatype/sample.csv.txt) и выполнена комадна"
"\"sample.csv\": \"src-datatype/sample.csv\" и выполнена комадна"
] ]
}, },
{ {
@@ -2091,10 +2105,10 @@
"source": [ "source": [
"На рис. показано, как выглядит полученная таблица в веб-броузере.\n", "На рис. показано, как выглядит полученная таблица в веб-броузере.\n",
"\n", "\n",
"<!-- dom:FIGURE: [fig-datatype/example_1.png, width=400 frac=1.0] Таблица, произведенная программой csv2html.py, в броузере <div id=\"datatype:examples:fig:1\"></div> -->\n", "<!-- dom:FIGURE: [fig-datatype/example_1.png, width=400 frac=1.0] Таблица, произведенная программой [csv2html.py](src-datatype/csv2html.py), в броузере <div id=\"datatype:examples:fig:1\"></div> -->\n",
"<!-- begin figure -->\n", "<!-- begin figure -->\n",
"<div id=\"datatype:examples:fig:1\"></div>\n", "<div id=\"datatype:examples:fig:1\"></div>\n",
"![Таблица, произведенная программой csv2html.py, в броузере](fig-datatype/example_1.png)<!-- end figure -->\n", "![Таблица, произведенная программой [csv2html.py](src-datatype/csv2html.py), в броузере](fig-datatype/example_1.png)<!-- end figure -->\n",
"\n", "\n",
"\n", "\n",
"Теперь, когда мы увидели, как используется программа и что она делает,\n", "Теперь, когда мы увидели, как используется программа и что она делает,\n",
@@ -2105,7 +2119,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 58, "execution_count": 59,
"metadata": { "metadata": {
"collapsed": false "collapsed": false
}, },
@@ -2128,10 +2142,10 @@
"функций в файле (то есть порядок, в котором они создаются) не \n", "функций в файле (то есть порядок, в котором они создаются) не \n",
"имеет значения.\n", "имеет значения.\n",
"\n", "\n",
"В программе `csv2html.py` первой вызываемой функцией является функция\n", "В программе [csv2html.py](src-datatype/csv2html.py) первой\n",
"`main()`, которая в свою очередь вызывает функции `print_start()` и\n", "вызываемой функцией является функция `main()`, которая в свою очередь\n",
"`print_line()`. Функция `print_line()` вызывает функции\n", "вызывает функции `print_start()` и `print_line()`. Функция\n",
"`extract_fields()` и `escape_html()`.\n", "`print_line()` вызывает функции `extract_fields()` и `escape_html()`.\n",
"\n", "\n",
"Когда интерпретатор Python читает файл, он начинает делать это с\n", "Когда интерпретатор Python читает файл, он начинает делать это с\n",
"самого начала. Поэтому сначала будет выполнен импорт (если он есть),\n", "самого начала. Поэтому сначала будет выполнен импорт (если он есть),\n",
@@ -2147,7 +2161,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 59, "execution_count": 60,
"metadata": { "metadata": {
"collapsed": false "collapsed": false
}, },
@@ -2190,7 +2204,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 60, "execution_count": 61,
"metadata": { "metadata": {
"collapsed": false "collapsed": false
}, },
@@ -2215,7 +2229,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 61, "execution_count": 62,
"metadata": { "metadata": {
"collapsed": false "collapsed": false
}, },
@@ -2273,7 +2287,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 62, "execution_count": 63,
"metadata": { "metadata": {
"collapsed": false "collapsed": false
}, },
@@ -2292,7 +2306,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 63, "execution_count": 64,
"metadata": { "metadata": {
"collapsed": false "collapsed": false
}, },
@@ -2337,7 +2351,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 64, "execution_count": 65,
"metadata": { "metadata": {
"collapsed": false "collapsed": false
}, },
@@ -2382,7 +2396,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 65, "execution_count": 66,
"metadata": { "metadata": {
"collapsed": false "collapsed": false
}, },

View File

@@ -354,7 +354,10 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": 1,
"metadata": { "metadata": {
"collapsed": false "collapsed": false,
"jupyter": {
"outputs_hidden": false
}
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -427,7 +430,10 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 2, "execution_count": 2,
"metadata": { "metadata": {
"collapsed": false "collapsed": false,
"jupyter": {
"outputs_hidden": false
}
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -550,7 +556,10 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 3, "execution_count": 3,
"metadata": { "metadata": {
"collapsed": false "collapsed": false,
"jupyter": {
"outputs_hidden": false
}
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -660,7 +669,10 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 4, "execution_count": 4,
"metadata": { "metadata": {
"collapsed": false "collapsed": false,
"jupyter": {
"outputs_hidden": false
}
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -748,7 +760,10 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 5, "execution_count": 5,
"metadata": { "metadata": {
"collapsed": false "collapsed": false,
"jupyter": {
"outputs_hidden": false
}
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -759,7 +774,10 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 6, "execution_count": 6,
"metadata": { "metadata": {
"collapsed": false "collapsed": false,
"jupyter": {
"outputs_hidden": false
}
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -770,7 +788,10 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 7, "execution_count": 7,
"metadata": { "metadata": {
"collapsed": false "collapsed": false,
"jupyter": {
"outputs_hidden": false
}
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -781,7 +802,10 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 8, "execution_count": 8,
"metadata": { "metadata": {
"collapsed": false "collapsed": false,
"jupyter": {
"outputs_hidden": false
}
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -792,7 +816,10 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 9, "execution_count": 9,
"metadata": { "metadata": {
"collapsed": false "collapsed": false,
"jupyter": {
"outputs_hidden": false
}
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -818,7 +845,10 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 10, "execution_count": 10,
"metadata": { "metadata": {
"collapsed": false "collapsed": false,
"jupyter": {
"outputs_hidden": false
}
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -829,7 +859,10 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 11, "execution_count": 11,
"metadata": { "metadata": {
"collapsed": false "collapsed": false,
"jupyter": {
"outputs_hidden": false
}
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -840,7 +873,10 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 12, "execution_count": 12,
"metadata": { "metadata": {
"collapsed": false "collapsed": false,
"jupyter": {
"outputs_hidden": false
}
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -851,7 +887,10 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 13, "execution_count": 13,
"metadata": { "metadata": {
"collapsed": false "collapsed": false,
"jupyter": {
"outputs_hidden": false
}
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -901,7 +940,10 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 14, "execution_count": 14,
"metadata": { "metadata": {
"collapsed": false "collapsed": false,
"jupyter": {
"outputs_hidden": false
}
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -912,7 +954,10 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 15, "execution_count": 15,
"metadata": { "metadata": {
"collapsed": false "collapsed": false,
"jupyter": {
"outputs_hidden": false
}
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -943,7 +988,10 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 16, "execution_count": 16,
"metadata": { "metadata": {
"collapsed": false "collapsed": false,
"jupyter": {
"outputs_hidden": false
}
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -967,7 +1015,10 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 17, "execution_count": 17,
"metadata": { "metadata": {
"collapsed": false "collapsed": false,
"jupyter": {
"outputs_hidden": false
}
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -978,7 +1029,10 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 18, "execution_count": 18,
"metadata": { "metadata": {
"collapsed": false "collapsed": false,
"jupyter": {
"outputs_hidden": false
}
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -989,7 +1043,10 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 19, "execution_count": 19,
"metadata": { "metadata": {
"collapsed": false "collapsed": false,
"jupyter": {
"outputs_hidden": false
}
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -1008,7 +1065,10 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 20, "execution_count": 20,
"metadata": { "metadata": {
"collapsed": false "collapsed": false,
"jupyter": {
"outputs_hidden": false
}
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -1019,7 +1079,10 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 21, "execution_count": 21,
"metadata": { "metadata": {
"collapsed": false "collapsed": false,
"jupyter": {
"outputs_hidden": false
}
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -1051,7 +1114,10 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 22, "execution_count": 22,
"metadata": { "metadata": {
"collapsed": false "collapsed": false,
"jupyter": {
"outputs_hidden": false
}
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -1091,7 +1157,10 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 23, "execution_count": 23,
"metadata": { "metadata": {
"collapsed": false "collapsed": false,
"jupyter": {
"outputs_hidden": false
}
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -1143,7 +1212,10 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 24, "execution_count": 24,
"metadata": { "metadata": {
"collapsed": false "collapsed": false,
"jupyter": {
"outputs_hidden": false
}
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -1154,7 +1226,10 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 25, "execution_count": 25,
"metadata": { "metadata": {
"collapsed": false "collapsed": false,
"jupyter": {
"outputs_hidden": false
}
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -1165,7 +1240,10 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 26, "execution_count": 26,
"metadata": { "metadata": {
"collapsed": false "collapsed": false,
"jupyter": {
"outputs_hidden": false
}
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -1206,7 +1284,10 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 27, "execution_count": 27,
"metadata": { "metadata": {
"collapsed": false "collapsed": false,
"jupyter": {
"outputs_hidden": false
}
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -1230,7 +1311,10 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 28, "execution_count": 28,
"metadata": { "metadata": {
"collapsed": false "collapsed": false,
"jupyter": {
"outputs_hidden": false
}
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -1300,7 +1384,10 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 29, "execution_count": 29,
"metadata": { "metadata": {
"collapsed": false "collapsed": false,
"jupyter": {
"outputs_hidden": false
}
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -1311,7 +1398,10 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 30, "execution_count": 30,
"metadata": { "metadata": {
"collapsed": false "collapsed": false,
"jupyter": {
"outputs_hidden": false
}
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -1342,7 +1432,10 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 31, "execution_count": 31,
"metadata": { "metadata": {
"collapsed": false "collapsed": false,
"jupyter": {
"outputs_hidden": false
}
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -1370,7 +1463,10 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 32, "execution_count": 32,
"metadata": { "metadata": {
"collapsed": false "collapsed": false,
"jupyter": {
"outputs_hidden": false
}
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -2133,7 +2229,25 @@
] ]
} }
], ],
"metadata": {}, "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.8.1"
}
},
"nbformat": 4, "nbformat": 4,
"nbformat_minor": 2 "nbformat_minor": 4
} }

View File

@@ -0,0 +1,72 @@
# -*- coding: utf-8 -*-
import collections
import sys
# Start 1st block
ID, FORENAME, MIDDLENAME, SURNAME, DEPARTMENT = range(5)
# End 1st block
User = collections.namedtuple("User",
"username forename middlename surname id")
# End 2d block
def main():
if len(sys.argv) == 1 or sys.argv[1] in {"-h", "--help"}:
print("usage: {0} file1 [file2 [... fileN]]".format(
sys.argv[0]))
sys.exit()
usernames = set()
users = {}
for filename in sys.argv[1:]:
with open(filename, encoding="utf8") as file:
for line in file:
line = line.rstrip()
if line:
user = process_line(line, usernames)
users[(user.surname.lower(), user.forename.lower(),
user.id)] = user
print_users(users)
def process_line(line, usernames):
fields = line.split(":")
username = generate_username(fields, usernames)
user = User(username, fields[FORENAME], fields[MIDDLENAME],
fields[SURNAME], fields[ID])
return user
def generate_username(fields, usernames):
username = ((fields[FORENAME][0] + fields[MIDDLENAME][:1] +
fields[SURNAME]).replace("-", "").replace("'", ""))
username = original_name = username[:8].lower()
count = 1
while username in usernames:
username = "{0}{1}".format(original_name, count)
count += 1
usernames.add(username)
return username
def print_users(users):
namewidth = 32
usernamewidth = 9
print("{0:<{nw}} {1:^6} {2:{uw}}".format(
"Name", "ID", "Username", nw=namewidth, uw=usernamewidth))
print("{0:-<{nw}} {0:-<6} {0:-<{uw}}".format(
"", nw=namewidth, uw=usernamewidth))
for key in sorted(users):
user = users[key]
initial = ""
if user.middlename:
initial = " " + user.middlename[0]
name = "{0.surname}, {0.forename}{1}".format(user, initial)
print("{0:.<{nw}} ({1.id:4}) {1.username:{uw}}".format(
name, user, nw=namewidth, uw=usernamewidth))
main()

View File

@@ -0,0 +1,8 @@
622 480 899 298 221 940 196 556 -7 593 250 699 966 530 143 22
-59 164 976 566 -56 960 340 754 620 533 528 308 47.3 14.5
10 51 22 06 50 79 90 34 68 50 -29 -19
29 58 73 15 4 6 17 5 4 5 3 7 5.5 9 1 7 8 -17 0 -9.5 5
299 985 834 72 -100 270 656 -44 255 38 616 845 -6 542 -81 379 279
7 33 50 88 2 91 20 93 60 80 43 93 67 80 41 14 99 73 59 73 74 26 28
39 81 41 18 83 30 74 72 51 15 59
0.9 97 3 35 11 54 50 58 24 11 26 79 21 61 15

95
src-collections/statistics.py Executable file
View File

@@ -0,0 +1,95 @@
import collections
import math
import sys
#Start 1st block
Statistics = collections.namedtuple("Statistics",
"mean mode median std_dev")
#End 1st block
def main():
if len(sys.argv) == 1 or sys.argv[1] in {"-h", "--help"}:
print("usage: {0} file1 [file2 [... fileN]]".format(
sys.argv[0]))
sys.exit()
numbers = []
frequencies = collections.defaultdict(int)
for filename in sys.argv[1:]:
read_data(filename, numbers, frequencies)
if numbers:
statistics = calculate_statistics(numbers, frequencies)
print_results(len(numbers), statistics)
else:
print("no numbers found")
def read_data(filename, numbers, frequencies):
with open(filename, encoding="ascii") as file:
for lino, line in enumerate(file, start=1):
for x in line.split():
try:
number = float(x)
numbers.append(number)
frequencies[number] += 1
except ValueError as err:
print("{filename}:{lino}: skipping {x}: {err}".format(
**locals()))
def calculate_statistics(numbers, frequencies):
mean = sum(numbers) / len(numbers)
mode = calculate_mode(frequencies, 3)
median = calculate_median(numbers)
std_dev = calculate_std_dev(numbers, mean)
return Statistics(mean, mode, median, std_dev)
def calculate_mode(frequencies, maximum_modes):
highest_frequency = max(frequencies.values())
mode = [number for number, frequency in frequencies.items()
if frequency == highest_frequency]
if not (1 <= len(mode) <= maximum_modes):
mode = None
else:
mode.sort()
return mode
def calculate_median(numbers):
numbers = sorted(numbers)
middle = len(numbers) // 2
median = numbers[middle]
if len(numbers) % 2 == 0:
median = (median + numbers[middle - 1]) / 2
return median
def calculate_std_dev(numbers, mean):
total = 0
for number in numbers:
total += ((number - mean) ** 2)
variance = total / (len(numbers) - 1)
return math.sqrt(variance)
def print_results(count, statistics):
real = "9.2f"
if statistics.mode is None:
modeline = ""
elif len(statistics.mode) == 1:
modeline = "mode = {0:{fmt}}\n".format(statistics.mode[0], fmt=real)
else:
modeline = ("mode = [" + ", ".join(["{0:.2f}".format(m)
for m in statistics.mode]) + "]\n")
print("""\
count = {0:6}
mean = {mean:{fmt}}
median = {median:{fmt}}
{1}\
std. dev. = {std_dev:{fmt}}""".format(count, modeline, fmt=real, **statistics._asdict()))
main()

29
src-collections/users.txt Normal file
View File

@@ -0,0 +1,29 @@
1080:Priscillia:Forbes:Shepard:Cleaning Services
4382:Devan::Fielder:Public Relations
6285:Grey::Collyer:Public Relations
6201:Kierah::Battaile:Catering
6671:Madilyn::Helling:Public Relations
4898:Deri-J::Watherston:Research
8954:Alec::Leng:Production
6263:Rebbekkah::Clifford:Cleaning Services
1704:Elorm::Lynes:Sales
2064:Kinza:Roxanna:Farrer:Research
4663:Zackery::Poyntz:Research
1601:Albert:Lukas:Montgomery:Legal
3702:Albert:Lukas:Montgomery:Sales
4730:Nadelle::Landale:Warehousing
4191:Cory:Diljeet:Stockill:Sales
6119:Rhae::Forrester:Sales
4454:Kieara::Milner:Cleaning Services
5502:Taylore:Amellia:Granse:Cleaning Services
7505:Tyra:Deborah:Elting:Research
7506:Tyra:Deborah:Elting:Catering
1183:Bridget:Beverley:Pace:Catering
7337:Nathen::Lemerrie:Customer Service
2462:Ashlee::Hooten:Production
0641:Kelci-Louise::Blakey:Sales
8866:Asir::Cowthwaite:Human Resources
0196:Niven:Cary:Sproule:Warehousing
0199:Niven:Cary:Sproule:Sales
0243:Niven:Cary:Sproule:Legal
4541:Keirien::Blenkinsop:Customer Service

278
src-collections/users2.txt Normal file
View File

@@ -0,0 +1,278 @@
4760:Samira::Mckellar:Production
3209:Daisy::Cobham:Marketing
0419:Naiya::Emmett:Research
4219:Khailan:Rhyan:Tardiff:Production
5275:Azami:Lilly:Shwenn:Warehousing
1703:Sameeta::Leadbeater:Production
0972:Zamin:Thorfinn:Carden:Warehousing
8036:Maude:Corran:Fairbairn:Climate Change
2095:Kole:Eochaidh:Alwood:Catering
9729:Roisin:Alexsandra:Bissett:Research
5347:Orlaith::Pettitt:Senior Management
4901:Amaar:Burhan:Kaye:Catering
0924:Nekoda::Mcmorran:Sales
5286:Kelsy::Dalzell:Production
0664:Martyna::Clapton:Human Resources
4660:Maninder::Bonnard:Public Relations
9331:Dannica::Willock:Senior Management
2059:Duha::Balderstone:Marketing
8193:Aubrey::Underhill:Human Resources
5027:Keedan::Reddoch:Legal
2004:Kenna::Linsey:Production
1842:Keven::Mcgee:Legal
5604:Josef:Brooke:Martinson:Transport
3894:Kobie::Elsom:Cleaning Services
2253:Khai:Kaira:Yelverton:Production
9837:Enarie:Sharleen:Keys:Senior Management
2570:Robbi:Shaunna:Cecil:Production
3016:Latifatu::Brinnan:Sales
4768:Giselle:Samia-Skye:Girdham:Customer Service
3461:Leighvi:Busra:Frarrer:Warehousing
4159:Dong-Hee::Roson:Sales
6800:Khaliq::Yates:Marketing
8621:Karma::Allison:Customer Service
0847:Rio::Trustram:Legal
2311:Mirrin::Bowstall:Sales
6611:Zarina::Sword:Transport
0149:Fredrick:Jeanie:Spencer:Production
8142:Kallin:Xavier:Ratcliff:Transport
8311:Amy-Louise::Coe:Public Relations
4288:Marek::Mcrae:Production
5956:Eabha::Neelin:Public Relations
7351:Edie::Crow:Public Relations
3025:Billie-Jay::Wingrove:Customer Service
2417:Deborah::Scherger:Production
5859:Mitchell:Donell:Ellerington:Legal
7312:Ailsa:Kianna:Sargesson:Marketing
7282:Lucyanne:Els:Apperson:Legal
6313:Eric::Chaplin:Senior Management
7173:Jaimee-Lee::Calloway:Cleaning Services
7645:Angelo-Carlo::Forrester:Senior Management
5222:Joshua::Matts:Climate Change
7471:Ali::Carradice:Marketing
7155:Nicoline::Eckhold:Sales
1629:Glen::Davies:Sales
1527:Andreas::Morfoot:Research
7908:Oihane:Pearse:Mohr:Public Relations
2921:Ma'az:Sharies:Mann:Cleaning Services
8394:Jay-Alexander:Maia:May:Climate Change
5697:Kian::Sellers:Climate Change
4462:Keryn::Cardno:Cleaning Services
8263:Jarrod::Royal:Cleaning Services
2108:Ayman::Baillie:Sales
8752:Ailis::Calvert:Sales
6299:Haroon::Hindmarsh:Production
9810:Dre::Byrom:Transport
5261:Robbyn::Kropp:Public Relations
1811:Gregor::Knott:Research
8386:Anton::Capes:Production
9486:Alyth::Lisenby:Production
7530:Makayla::Looper:Cleaning Services
0676:Alistair::Gosling:Climate Change
8529:Pia:Alea:Jarvis:Research
5087:Dante::Windham:Production
0743:Mahirah::Ashton:Orders
2654:Niah::Selby:Marketing
9707:Ma-an::Gifford:Senior Management
1278:Kamron::Rohrbach:Climate Change
1506:Tianna::Macfie:Production
5159:Arlene::Behymer:Legal
8208:Anya:Fredrick:Grissom:Cleaning Services
0568:Rubie::Mcgeorge:Legal
5372:David:Rohana:Dalgliesh:Human Resources
9256:Chelsey:Carl:Challenor:Senior Management
2633:Neervana::Annie:Human Resources
9196:Fabrizio::Coombe:Sales
3537:Kirstin::Barret:Orders
5756:Maryann:Anisha:Moodie:Sales
6913:Nurintishar::Cavill:Human Resources
9308:Rehan:Joleen:Brennand:Senior Management
0776:Dawn::Leader:Production
9449:Brendyn:Tiernan:Cummings:Marketing
8985:Brogan:Aisling:Warne:Cleaning Services
9399:Kelsay::Rix:Sales
3021:Ben::Wallace:Customer Service
3928:Primrose:Shelly:Handfield:Human Resources
9942:Arlene::Slater:Cleaning Services
3423:Brendon::Boswell:Marketing
7979:Caitlynn::Bonnetta:Sales
8633:Aydan:Greta:Youll:Production
0703:Jenni::Few:Legal
1081:Gregory::Mell:Legal
8656:Ailee:Bryden:Seabrooke:Sales
9985:Pip:Giulia:Lewie:Climate Change
8469:Fionna::Phipps:Sales
4777:Brogan::Hearn:Sales
2332:Corry::Climo:Sales
0520:Ruqaya:Alexi:Norton:Production
3352:Shiran::Chalifour:Research
9235:Cheuk::Trevannion:Senior Management
1026:Khaliq::Hindley:Sales
9372:Murryn::Mcbride:Production
9379:Nur::Rinn:Cleaning Services
1043:Nya:Hebe:Marnie:Production
0063:Eilis:Jeannie:Macmillan:Sales
5285:Arabella:Samara:Farrer:Transport
1859:Fatemah::Living:Sales
4911:Jin-Hwan:Keris:Carew:Human Resources
0489:Gurpreet::Mulvie:Climate Change
7167:Samad::Whiteside:Marketing
4732:Kian::Emmett:Warehousing
2370:Shatha::Aitkin:Sales
6719:Abbey-Lee:Zakeria:Passmore:Cleaning Services
0851:Abdallah:Krishna:Doherty:Marketing
4073:Harriett::Smorthwaite:Marketing
7195:Kenzi:Stacie-Lee:Greenall:Climate Change
4014:Khadeeja:Madilyn:Malbis:Sales
5837:Reanne:Jaedon:Ellicott:Marketing
2796:Yanis::Hindley:Marketing
6290:Devan::Weidenmeyer:Customer Service
5915:Heather:Aidan:Moorehouse:Climate Change
4626:Lyndsey::Dolling:Transport
6776:Leigh-Ann::Supierz:Public Relations
5043:Jacy::Fryer:Marketing
5681:Jai::Vaill:Marketing
4156:Cameron::Christian:Research
6663:Bronwyn::Rodgerson:Transport
4478:Samanta::Lawrenson:Marketing
8337:Ramsey:Nina:Dimascio:Catering
2402:Julius::Haggar:Climate Change
7010:Tamlynn::Rakestraw:Marketing
2193:Braeden::Hoggins:Sales
0266:Rhea:Ruqaya:Hazelgreave:Climate Change
7106:Rhyce::Lord:Production
8037:Tamunotonye:Yann:Craggs:Cleaning Services
0262:Georgie::Coad:Climate Change
2492:Luisadh:Haigan:Ugill:Sales
2062:Justice::Mathieson:Warehousing
1692:Kailey:Denny:Blain:Sales
2259:Rania:Ciar:Dodwell:Sales
9786:Kristin::Shearer:Production
8874:Rayyan:Anwar:Falhouse:Climate Change
5113:Leland::Kightley:Production
6197:Christina::Dodshon:Climate Change
1012:Ewan::Sergeantson:Research
0827:Lexy::Cramp:Legal
5407:Indi:Alba:Cage:Orders
4645:Farjan::Woodburn:Human Resources
6162:Prabhkaran:Taryn:Garthwaite:Sales
4272:Jaydon:Vincent:Locket:Customer Service
4053:Islam::Krouskup:Senior Management
6110:Keeva::Rumfit:Sales
4234:Amina::Callander:Transport
5680:Julius:Vyctoria:Shepard:Production
3988:Karis:India:Peck:Human Resources
9137:Ross::Godolpin:Legal
3401:Rikki::Plamondon:Climate Change
1853:Elisabeth::Wasling:Human Resources
0475:Roma::Dow:Sales
5998:Elizabeth::Helliwell:Production
1535:Breerah::Mcphail:Customer Service
7156:Nur'Ain::Tighe:Orders
4249:Julius::Jalfon:Warehousing
7817:Kellise:Dania:Whitefield:Sales
6511:Kirstyn:Ayse:Rooke:Research
5505:Heatham::Mcminn:Catering
9695:Vera:Mason:Gidman:Climate Change
2612:Jugjeevan:Declyn:Goldie:Legal
5017:Armin::Connery:Transport
6991:Debbieleigh::Gladwyn:Production
9779:Hawa:Nowaa:Swainbank:Senior Management
5972:Evann::Laird:Marketing
7863:Aleena::Meissner:Orders
6944:Louis::Newbould:Senior Management
0023:Rogan::Rumble:Legal
4887:Tana::Donn:Transport
7499:Ted::Cherry:Senior Management
6742:Jeenan:Clara:Mcnutt:Production
8418:Jonny:Diesel:Elton:Marketing
5520:Samson:Haleema:Senkow:Research
7544:Maryanne:Samuele:Lily:Senior Management
9799:Kole::Scoville:Orders
6271:McLaren::Knapp:Production
4678:Connon::Bottomly:Marketing
4235:Mirza::Whiteside:Senior Management
8958:Shanice:Marilyn:Notman:Transport
8115:Emma::Wennerbom:Production
8963:Michel-Ange:Francesca:Ferrell:Sales
8151:Amaya::Grace:Human Resources
6188:Eve-Rose::Veach:Catering
0716:Kimi::Rorbach:Catering
8776:Lilyjo::Graw:Cleaning Services
8518:Ophelia::Franks:Orders
8906:Bradley::Kelsey:Sales
8733:Aby::Lackland:Orders
0279:Bregan::Blood:Sales
4547:Annabella:Bobi-Lea:Elvy:Marketing
7067:Abrar:Matheullah:Yuile:Sales
6640:Karra:Laseinia:Budden:Sales
7073:Harvey:Haniya:Janssen:Research
1193:Kellise:Mykaela:Kevan:Public Relations
8242:Lowri::Tattersall:Transport
7684:Blane::Thwaits:Production
0926:Tamara:Meadow:Nason:Sales
9304:Karmyn::Farragher:Human Resources
7453:Ossian:Mallory:Dryden:Customer Service
5116:Loreta::Lampkin:Sales
6254:Lara::Baylis:Legal
0600:Wiktoria:Hesle:Helme:Human Resources
0071:Daniela:Marymarie:Halliman:Research
3617:Keigan:Yi-An:Wennerbom:Senior Management
8429:Nicole::Alderson:Sales
9514:Kaylin::Clontz:Production
1664:Baizah::Kilham:Sales
4099:Areeya::Linahon:Human Resources
8801:Vegas::Yelverton:Marketing
9309:Kelly:Waris:Haigh:Research
6531:Kahl::Wyman:Research
6127:Alexzandra:Janica:Bullington:Production
9885:Carrie:Doone:Estes:Production
4386:Julia::Wray:Production
2346:Nell::Cordingly:Production
9539:Quin:Abel:Battaile:Human Resources
7959:Guramrit::Jennison:Production
8000:Braedyn::Buttenshaw:Human Resources
0256:Akamveer::Bellard:Sales
6769:Kirstyn::Archer:Sales
0900:Reen:Oakley:Spurlock:Cleaning Services
6427:Gretchen::Webber:Catering
2432:Aliana::Learmont:Warehousing
8232:Seth::Curwen:Cleaning Services
5422:Erona::Wortham:Transport
0267:Faheez::Lupo:Transport
9205:Bailee:Layna:Julia:Cleaning Services
3862:Alexander-Bruce:Jami:Solley:Customer Service
9230:Paris-Nicole::Smorthwaite:Orders
6813:Allana::Sisley:Climate Change
9521:Liza::Shap:Research
3473:Rebbeca::Farmarie:Research
6893:Ellie-May::Mcmurdo:Research
6880:Joela:Lila:Killigrew:Production
7460:Tammy::Waind:Marketing
9978:Davydas:Julian:Waggoners:Catering
6549:Rianne::Elson:Sales
2939:Eesa:McCody:Duncan:Production
6195:Josey::Bunn:Sales
4579:Nikolaus::Sherwin:Production
9472:Suhayb::Cottingham:Research
9946:Duha::Criswick:Production
4557:Lennan:Musammath:Selby:Production
9785:Deuie:Harvey-Lee:Lawrence:Sales
3097:Yousf:Glet:Capes:Marketing
2312:Katrina::Florack:Human Resources
5695:Kasey::Macpherson:Sales
3023:Tawhid::Tyldesley:Marketing
9894:Omolara::Whitehouse:Senior Management
0833:Khaled::Plats:Orders
8817:Gurkeerat::Hargreaves:Marketing
2903:Rumsha::Kay:Sales
7066:Jay-D::Copland:Sales
1484:Arun:Orchid:Caton:Marketing
8730:Errin::Dodwell:Climate Change
4716:Gerrard::Cautherey:Sales
9097:Madysan::Cawley:Public Relations
7803:Kareem::Moffit:Sales
3010:Jayne-Marie:Baban:Lyster:Research
4669:Iman::Spicer:Sales
0021:Justin::Radclyffe:Sales
8959:Siddharth::Gunn:Production

View File

@@ -0,0 +1,5 @@
"COUNTRY",2000,2001,2002,2003,2004
"ANTIGUA AND BARBUDA",0,0,0,0,0
"ARGENTINA",37,35,33,36,39
"BAHAMAS, THE",1,1,1,1,1
"BAHRAIN",5,6,6,6,6

View File

@@ -0,0 +1,14 @@
# -*- coding: utf-8 -*-
def fib(n):
"""
Возвращает список первых n чисел Фибоначи
"""
f0, f1 = 0, 1
f = [1]*n
for i in range(1, n):
f[i] = f0 + f1
f0, f1 = f1, f[i]
return f
print(fib(10))

View File

@@ -0,0 +1 @@
print("Hello from Python!")

View File

@@ -0,0 +1,2 @@
a = int(input())
print(a**2+a)

View File

@@ -1,2 +1,2 @@
a = int(input()) a = int(input())
print(a**2) print(a**2+a)