From 58a114e77de518b4c2c5a214033692936a31e9f9 Mon Sep 17 00:00:00 2001 From: "merant88@mail.ru" Date: Thu, 10 Sep 2020 20:48:43 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=97=20=D0=BA=204=20=D1=83=D1=80=D0=BE?= =?UTF-8?q?=D0=BA=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- #1.py | 7 +++++++ #2.py | 3 +++ #3.py | 2 ++ #4.py | 3 +++ #5.py | 4 ++++ #6.py | 19 +++++++++++++++++++ #7.py | 11 +++++++++++ README.md | 1 - 8 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 #1.py create mode 100644 #2.py create mode 100644 #3.py create mode 100644 #4.py create mode 100644 #5.py create mode 100644 #6.py create mode 100644 #7.py delete mode 100644 README.md diff --git a/#1.py b/#1.py new file mode 100644 index 0000000..325d310 --- /dev/null +++ b/#1.py @@ -0,0 +1,7 @@ +from sys import argv + +hours = int(argv[1]) +hourly_rate = int(argv[2]) +bonuses = int(argv[3]) + +print(f'Заработная плата сорудников {hours * hourly_rate / bonuses}') \ No newline at end of file diff --git a/#2.py b/#2.py new file mode 100644 index 0000000..76b6ecb --- /dev/null +++ b/#2.py @@ -0,0 +1,3 @@ +int_list = [300, 2, 12, 44, 1, 1, 4, 10, 7, 1, 78, 123, 200] +sec_list = [el for el in int_list[1:] if el > int_list[int_list.index(el)-1]] +print(sec_list) \ No newline at end of file diff --git a/#3.py b/#3.py new file mode 100644 index 0000000..d795d2a --- /dev/null +++ b/#3.py @@ -0,0 +1,2 @@ +list = [x for x in range(20, 241) if x % 20 == 0 or x % 21 == 0] +print(list) \ No newline at end of file diff --git a/#4.py b/#4.py new file mode 100644 index 0000000..3507e18 --- /dev/null +++ b/#4.py @@ -0,0 +1,3 @@ +list = [2, 2, 2, 7, 23, 1, 44, 44, 3, 2, 10, 7, 4, 11] +new_list = [x for x in list if list.count(x) == 1] +print(new_list) \ No newline at end of file diff --git a/#5.py b/#5.py new file mode 100644 index 0000000..61d7e84 --- /dev/null +++ b/#5.py @@ -0,0 +1,4 @@ +from functools import reduce + +my_list = [x for x in range(100, 1001) if x%2 == 0] +print(reduce(lambda x, y: x*y, my_list)) \ No newline at end of file diff --git a/#6.py b/#6.py new file mode 100644 index 0000000..0cc56c1 --- /dev/null +++ b/#6.py @@ -0,0 +1,19 @@ +from itertools import cycle, count + + +n = 3 +list = [1, 2, 3, 'abd', 4] + + +for a in count(n): + if a == n+10: + break + print(a) + +c = 0 + +for a in cycle(list): + print(a) + c+=1 + if c == 10: + break \ No newline at end of file diff --git a/#7.py b/#7.py new file mode 100644 index 0000000..e2ad3bc --- /dev/null +++ b/#7.py @@ -0,0 +1,11 @@ +def fac(n): + result = 1 + for i in range(1, n+1): + result *= i + yield result + + + +n = 4 +for el in fac(n): + print(el) \ No newline at end of file diff --git a/README.md b/README.md deleted file mode 100644 index 374fdf5..0000000 --- a/README.md +++ /dev/null @@ -1 +0,0 @@ -# Python_basics \ No newline at end of file