mirror of
https://github.com/nicholasChieftain/1_semester_python_liga.git
synced 2024-11-26 06:30:51 +03:00
[+]add example for 15 and 16 lessons
This commit is contained in:
parent
dffe04c27a
commit
24b85c4ede
88
Lesson_15_16_Example.ipynb
Normal file
88
Lesson_15_16_Example.ipynb
Normal 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
|
||||
}
|
Loading…
Reference in New Issue
Block a user