From 6980a74943768e790ee81e6a21213f259a4f22f0 Mon Sep 17 00:00:00 2001 From: nazarStarenchenko Date: Mon, 23 Dec 2019 22:54:40 +0200 Subject: [PATCH] added task files --- starenchenkonv/first/task1.py | 8 ++++++++ starenchenkonv/first/task2.py | 7 +++++++ starenchenkonv/first/task3.py | 11 +++++++++++ starenchenkonv/second/task1.py | 34 ++++++++++++++++++++++++++++++++++ 4 files changed, 60 insertions(+) create mode 100644 starenchenkonv/first/task1.py create mode 100644 starenchenkonv/first/task2.py create mode 100644 starenchenkonv/first/task3.py create mode 100644 starenchenkonv/second/task1.py diff --git a/starenchenkonv/first/task1.py b/starenchenkonv/first/task1.py new file mode 100644 index 0000000..aa26287 --- /dev/null +++ b/starenchenkonv/first/task1.py @@ -0,0 +1,8 @@ +new_list = [1,2,4,5.1,5.5,6,7.7,67.6,453.6,4356.56,5645.6] +float_list = [] + +for index in new_list: + if isinstance(index ,float): + float_list.append(index) + +print(len(float_list)) diff --git a/starenchenkonv/first/task2.py b/starenchenkonv/first/task2.py new file mode 100644 index 0000000..d53f602 --- /dev/null +++ b/starenchenkonv/first/task2.py @@ -0,0 +1,7 @@ +text = "hello my Name Is Nazar" + +text_list = text.split() + +for word in text_list: + if word[0].isupper(): + print(word) \ No newline at end of file diff --git a/starenchenkonv/first/task3.py b/starenchenkonv/first/task3.py new file mode 100644 index 0000000..3b73ef9 --- /dev/null +++ b/starenchenkonv/first/task3.py @@ -0,0 +1,11 @@ +num_1 = float(input("type number: ")) +num_2 = float(input("type number: ")) +counter = 1 +num_1_int = int(num_1) +num_2_int = int(num_2) + +for index in range(num_1_int, num_2_int + 1): + if index > 0: + counter = counter * index + +print(counter) \ No newline at end of file diff --git a/starenchenkonv/second/task1.py b/starenchenkonv/second/task1.py new file mode 100644 index 0000000..58231cf --- /dev/null +++ b/starenchenkonv/second/task1.py @@ -0,0 +1,34 @@ +import re + +def is_date(date): + return bool(re.match(r"\d{2}[-]\d{2}[-]\d+", date)) + +date = input("enter date: ") +while not is_date(date): + date = input("enter date: ") + +day_list = ["Понеділок", "Вівторок", "Середа", "Четвер", "П'ятниця", "Субота", "Неділя"] + +date_list = date.split("-") + +for index in range(len(date_list)): + + date_list[index] = int(date_list[index]) + + +def main(date_list): + if date_list[0] > 30 or date_list[1] > 12 or date_list[2] < 1: + + print("error") + else: + if date_list[2] % 4 == 0: + #рік високосний + high_years = date_list[2] / 4 #кількість високосних років + else: + #рік не високосний + pass + + + +main(date_list) +