Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions deprecated_tests/sem02/tests/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions deprecated_tests/sem02/tests/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions deprecated_tests/sem02/tests/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions deprecated_tests/sem02/tests/.idea/tests.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions deprecated_tests/sem02/tests/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions homeworks/sem01/hw1/backoff.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from random import uniform
from time import sleep
from typing import (
Callable,
ParamSpec,
Expand Down
2 changes: 1 addition & 1 deletion solutions/sem01/lesson02/task3.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
def get_amount_of_ways_to_climb(stair_amount: int) -> int:
step_prev, step_curr = 1, 1
_step_prev, step_curr = 1, 1
# ваш код
return step_curr
2 changes: 1 addition & 1 deletion solutions/sem01/lesson03/task1.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
def flip_bits_in_range(num: int, left_bit: int, right_bit: int) -> int:
# ваш код
return num
return num
2 changes: 1 addition & 1 deletion solutions/sem01/lesson03/task2.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
def get_cube_root(n: float, eps: float) -> float:
# ваш код
return n
return n
2 changes: 1 addition & 1 deletion solutions/sem01/lesson04/task1.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
def is_arithmetic_progression(lst: list[list[int]]) -> bool:
# ваш код
return False
return False
2 changes: 1 addition & 1 deletion solutions/sem01/lesson04/task2.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
def merge_intervals(intervals: list[list[int, int]]) -> list[list[int, int]]:
# ваш код
return [[0,0]]
return [[0, 0]]
2 changes: 1 addition & 1 deletion solutions/sem01/lesson04/task4.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
def move_zeros_to_end(nums: list[int]) -> list[int]:
# ваш код
return 0
return 0
2 changes: 1 addition & 1 deletion solutions/sem01/lesson04/task5.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
def find_row_with_most_ones(matrix: list[list[int]]) -> int:
# ваш код
return 0
return 0
4 changes: 2 additions & 2 deletions solutions/sem01/lesson04/task6.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
def count_cycles(arr: list[int]) -> int:
def count_cycles(arr: list[int]) -> int:
# ваш код
return 0
return 0
2 changes: 1 addition & 1 deletion solutions/sem01/lesson05/task1.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
def is_palindrome(text: str) -> bool:
# ваш код
return False
return False
2 changes: 1 addition & 1 deletion solutions/sem01/lesson05/task2.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
def are_anagrams(word1: str, word2: str) -> bool:
# ваш код
return False
return False
2 changes: 1 addition & 1 deletion solutions/sem01/lesson05/task4.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
def unzip(compress_text: str) -> str:
# ваш код
return compress_text
return compress_text
4 changes: 2 additions & 2 deletions solutions/sem01/lesson05/task5.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
def reg_validator(reg_expr: str, text: str) -> bool:
def reg_validator(reg_expr: str, text: str) -> bool:
# ваш код
return False
return False
2 changes: 1 addition & 1 deletion solutions/sem01/lesson05/task6.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
def simplify_path(path: str) -> str:
# ваш код
return path
return path
2 changes: 1 addition & 1 deletion solutions/sem01/lesson06/task1.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
def int_to_roman(num: int) -> str:
# ваш код
return ""
return ""
2 changes: 1 addition & 1 deletion solutions/sem01/lesson06/task2.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
def get_len_of_longest_substring(text: str) -> int:
# ваш код
return 0
return 0
1 change: 0 additions & 1 deletion solutions/sem01/lesson06/task3.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@ def is_there_any_good_subarray(
nums: list[int],
k: int,
) -> bool:

# ваш код
return False
2 changes: 1 addition & 1 deletion solutions/sem01/lesson06/task4.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
def count_unique_words(text: str) -> int:
# ваш код
return 0
return 0
3 changes: 2 additions & 1 deletion solutions/sem01/lesson08/task1.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from typing import Callable


def make_averager(accumulation_period: int) -> Callable[[float], float]:
# ваш код
pass
pass
8 changes: 3 additions & 5 deletions solutions/sem01/lesson08/task2.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

T = TypeVar("T")

def collect_statistic(
statistics: dict[str, list[float, int]]
) -> Callable[[T], T]:


def collect_statistic(statistics: dict[str, list[float, int]]) -> Callable[[T], T]:
# ваш код
pass
pass
3 changes: 0 additions & 3 deletions solutions/sem01/lesson12/task3.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import sys


class FileOut:
def __init__(
self,
Expand Down
5 changes: 5 additions & 0 deletions solutions/sem02/lesson03/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions solutions/sem02/lesson03/.idea/lesson03.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions solutions/sem02/lesson03/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions solutions/sem02/lesson03/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions solutions/sem02/lesson03/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 13 additions & 3 deletions solutions/sem02/lesson03/task1.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,23 @@ class ShapeMismatchError(Exception):
def sum_arrays_vectorized(
lhs: np.ndarray,
rhs: np.ndarray,
) -> np.ndarray: ...
) -> np.ndarray:
if lhs.shape != rhs.shape:
raise ShapeMismatchError
return np.add(lhs, rhs)


def compute_poly_vectorized(abscissa: np.ndarray) -> np.ndarray: ...
def compute_poly_vectorized(abscissa: np.ndarray) -> np.ndarray:
return 3 * (abscissa**2) + 2 * abscissa + 1


def get_mutual_l2_distances_vectorized(
lhs: np.ndarray,
rhs: np.ndarray,
) -> np.ndarray: ...
) -> np.ndarray:
if lhs.shape[1] != rhs.shape[1]:
raise ShapeMismatchError
new_lhs = lhs[:, np.newaxis, :]
new_rhs = rhs[np.newaxis, :]
difference = new_lhs - new_rhs
return np.sqrt(np.sum(difference**2, axis=2))
25 changes: 23 additions & 2 deletions solutions/sem02/lesson03/task2.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import numpy as np
from numpy.ma.core import arccos, arctan2


class ShapeMismatchError(Exception):
Expand All @@ -9,11 +10,31 @@ def convert_from_sphere(
distances: np.ndarray,
azimuth: np.ndarray,
inclination: np.ndarray,
) -> tuple[np.ndarray, np.ndarray, np.ndarray]: ...
) -> tuple[np.ndarray, np.ndarray, np.ndarray]:
if (
(distances.shape != azimuth.shape)
or (distances.shape != inclination.shape)
or (azimuth.shape != inclination.shape)
):
raise ShapeMismatchError
abscissa = distances * np.sin(inclination) * np.cos(azimuth)
ordinates = distances * np.sin(inclination) * np.sin(azimuth)
applicates = distances * np.cos(inclination)
return abscissa, ordinates, applicates


def convert_to_sphere(
abscissa: np.ndarray,
ordinates: np.ndarray,
applicates: np.ndarray,
) -> tuple[np.ndarray, np.ndarray, np.ndarray]: ...
) -> tuple[np.ndarray, np.ndarray, np.ndarray]:
if (
(abscissa.shape != ordinates.shape)
or (abscissa.shape != applicates.shape)
or (ordinates.shape != applicates.shape)
):
raise ShapeMismatchError
distances = (abscissa**2 + ordinates**2 + applicates**2) ** 0.5
inclication = arccos(applicates / distances)
azimuth = arctan2(ordinates, abscissa)
return distances, azimuth, inclication
10 changes: 9 additions & 1 deletion solutions/sem02/lesson03/task3.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,12 @@

def get_extremum_indices(
ordinates: np.ndarray,
) -> tuple[np.ndarray, np.ndarray]: ...
) -> tuple[np.ndarray, np.ndarray]:
if len(ordinates) < 3:
raise ValueError
mask_for_maximums = (ordinates[1:-1] > ordinates[:-2]) & (ordinates[1:-1] > ordinates[2:])
mask_for_minimums = (ordinates[1:-1] < ordinates[:-2]) & (ordinates[1:-1] < ordinates[2:])

index_of_minimum = np.arange(1, len(ordinates) - 1)[mask_for_minimums]
index_of_maximum = np.arange(1, len(ordinates) - 1)[mask_for_maximums]
return index_of_minimum, index_of_maximum
5 changes: 5 additions & 0 deletions solutions/sem02/lesson04/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions solutions/sem02/lesson04/.idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions solutions/sem02/lesson04/.idea/lesson04.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading