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