Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
221 changes: 221 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
# Created by .ignore support plugin (hsz.mobi)
### Python template
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

.idea/.gitignore
.idea/inspectionProfiles/
.idea/misc.xml
.idea/modules.xml
.idea/python_13_10_2020.iml
.idea/vcs.xml
1 change: 1 addition & 0 deletions homeworks/les01/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#
6 changes: 3 additions & 3 deletions homeworks/les01/task01.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

a = 12 # целое
b = 12.0 # с плавающей точкой
c = 'Замечен слабый интеллект'
c = 'Замечен слабый интеллект' # строка

print(a, b, c)

name = input('введите ваше имя: ')
title = input('введите ваше звание: ')
title = input('введите ваше звание (поручик, доцент, ... ): ')
age = int(input('введите возраст: '))
value = float(input('введите годовой доход (тыс.): '))

print(f'Уважаемый {title} {name}, в {age} лет/года ваше состояние в год увеличивается на {value} тыс. руб. ')
print(f'Уважаемый {title} {name}, в {age} лет/год(а) ваше состояние в год увеличивается на {value} тыс. руб. ')
10 changes: 8 additions & 2 deletions homeworks/les01/task02.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,11 @@
Используйте форматирование строк.
"""

second = int(input('Введите время в секундах: '))
print(f'Введено время: {second//(60*60)}:{(second-second//(60*60))//60}:{second - second-second//(60*60)//60}')
seconds = int(input('Введите время в секундах: '))

num_hours = seconds // 3600
num_minutes = (seconds % 3600) // 60
num_seconds = seconds % 60

print(f'Введено время: {num_hours:02}:{num_minutes:02}:{num_seconds:02}')
print(f'В секундах: {num_hours * 3600 + num_minutes * 60 + num_seconds}')
20 changes: 20 additions & 0 deletions homeworks/les01/task03.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
"""

3. Узнайте у пользователя число n.
Найдите сумму чисел n + nn + nnn.
Например, пользователь ввёл число 3.
Считаем 3 + 33 + 333 = 369.

"""

num1 = input('Введите число: ') # воод ввод числа
num_digits = len(num1)
num1 = int(num1)
summa = 0 # общая сумма
digits = 0

for rank in range(0, 3 * num_digits, num_digits):
digits += num1 * 10 ** rank #
summa += digits

print('Сумма чисел :', summa)
18 changes: 18 additions & 0 deletions homeworks/les01/task04.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"""
4. Пользователь вводит целое положительное число.
Найдите самую большую цифру в числе.
Для решения используйте цикл while и арифметические операции.
"""

value = int(input('Введите целое положительное число: '))
digit_max = 0
while value > 0:
# остаток от деления на 10 - это текущий 1 разряд
digit = value % 10
if digit > digit_max:
digit_max = digit
# делим на 10 на цело - сдвиг на 1 разряд
value //= 10
print('Самая большую цифра в числе: ', digit_max)


20 changes: 20 additions & 0 deletions homeworks/les01/task05.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
"""
5. Запросите у пользователя значения выручки и издержек фирмы.
Определите, с каким финансовым результатом работает фирма
(прибыль — выручка больше издержек, или убыток — издержки больше выручки).
Выведите соответствующее сообщение.
Если фирма отработала с прибылью, вычислите рентабельность выручки
(соотношение прибыли к выручке).
Далее запросите численность сотрудников фирмы и определите прибыль фирмы в расчете на одного сотрудника.
"""
revenue = int(input('Введите значения выручки (тыс.): '))
costs = int(input('Введите значения издержек (тыс.): '))

if revenue > costs:
print("Предприятие работает с прибылью!")
income = revenue - costs; # доход = операционная выручка - расходы
print(f'Рентабельность выручки: {(income / revenue) * 100}%') # todo проверить вычисление рентабельности
num_member = int(input('Введите численность сотрудников: '))
print('Прибыль фирмы в расчете на одного сотрудника (тыс.): ', income / num_member)
else:
print("Предприятие работает в убыток...")
29 changes: 29 additions & 0 deletions homeworks/les01/task06.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"""
6. Спортсмен занимается ежедневными пробежками.
В первый день его результат составил a километров.
Каждый день спортсмен увеличивал результат на 10 % относительно предыдущего.
Требуется определить номер дня, на который общий результат спортсмена составить не менее b километров.
Программа должна принимать значения параметров a и b и выводить одно натуральное число — номер дня.

Например:a = 2, b = 3.
Результат:
1-й день: 2
2-й день: 2,2
3-й день: 2,42
4-й день: 2,66
5-й день: 2,93
6-й день: 3,22
Ответ: на 6-й день спортсмен достиг результата — не менее 3 км.

"""
num_day = 1
distance_day_1 = int(input('Введите результат первого дня (км): '))
challenge = int(input('Введите желаемый результат (км): '))
distance_day_current = distance_day_1 # текущий результат

while distance_day_current < challenge: # продолжаем пока не достигли результата
distance_day_current *= 1.1 # увеличили результат на 10%
num_day += 1 # день прошел
print('значение', distance_day_current)

print('Номер дня: ', num_day)