1_semester_python_liga/Lesson_15_16_Example.ipynb
2020-05-20 13:32:14 +05:00

89 lines
1.7 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
"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
}