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