From bb40abdf2441d4ea1f7caccf0f536db23845c352 Mon Sep 17 00:00:00 2001 From: cool07 <57254336+cool07@users.noreply.github.com> Date: Thu, 10 Sep 2020 12:16:23 +0300 Subject: [PATCH] Add files via upload --- Practice/Karpov_A/Lec_7/t7_1.py | 18 ++++++++++++++++++ Practice/Karpov_A/Lec_7/t7_2.py | 8 ++++++++ Practice/Karpov_A/Lec_7/text.txt | 1 + 3 files changed, 27 insertions(+) create mode 100644 Practice/Karpov_A/Lec_7/t7_1.py create mode 100644 Practice/Karpov_A/Lec_7/t7_2.py create mode 100644 Practice/Karpov_A/Lec_7/text.txt diff --git a/Practice/Karpov_A/Lec_7/t7_1.py b/Practice/Karpov_A/Lec_7/t7_1.py new file mode 100644 index 00000000..1cb98687 --- /dev/null +++ b/Practice/Karpov_A/Lec_7/t7_1.py @@ -0,0 +1,18 @@ +from datetime import datetime +from datetime import timedelta + +start_date = '01-08-2020' +end_date = '10-09-2020' + +def working_day(statr_date, end_date): + fd = datetime.strptime(start_date, '%d-%m-%Y') + ld = datetime.strptime(end_date, '%d-%m-%Y') + zoom = ld - fd + date = fd + work_days = 0 + for i in range(int(zoom.days)+1): + if date.strftime('%A') != 'Saturday' and date.strftime('%A') != 'Sunday': + work_days += 1 + date += timedelta(days=1) + return work_days +print(working_day(start_date, end_date)) \ No newline at end of file diff --git a/Practice/Karpov_A/Lec_7/t7_2.py b/Practice/Karpov_A/Lec_7/t7_2.py new file mode 100644 index 00000000..96b6c4f7 --- /dev/null +++ b/Practice/Karpov_A/Lec_7/t7_2.py @@ -0,0 +1,8 @@ +import subprocess + + +def read(file): + subprocess.run(['type', file], shell=True) + + +read(r"E:\Работы по программированию\Python\DZ_6_lec7\text.txt") \ No newline at end of file diff --git a/Practice/Karpov_A/Lec_7/text.txt b/Practice/Karpov_A/Lec_7/text.txt new file mode 100644 index 00000000..289439e5 --- /dev/null +++ b/Practice/Karpov_A/Lec_7/text.txt @@ -0,0 +1 @@ +Hello!!! How are you! \ No newline at end of file