[+]add example for 15 and 16 lessons

This commit is contained in:
n1ch1 2020-05-20 13:32:14 +05:00
parent dffe04c27a
commit 24b85c4ede
2 changed files with 88 additions and 0 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@ -0,0 +1,88 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Пример с очисткой экрана"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from IPython.display import clear_output\n",
"\n",
"while True:\n",
" print('Hello')\n",
" clear_output(wait=True)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Пример с выводом случайного числа"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import random\n",
"\n",
"print(random.randint(0, 10)) #Вывод случайного целого числа из диапазона от 0 до 10"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Пример таймера "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import time\n",
"\n",
"start_time = int(time.time())\n",
"timer = 10\n",
"\n",
"while int(time.time()) < start_time + timer:\n",
" print(start_time + timer - int(time.time()))\n",
" time.sleep(1)\n",
" \n",
"print('Конец таймера')"
]
}
],
"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.7.3"
}
},
"nbformat": 4,
"nbformat_minor": 4
}