Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 181dfad

Browse files
committed
added typing && small fixes
1 parent 9b88eac commit 181dfad

File tree

17 files changed

+136
-63
lines changed

17 files changed

+136
-63
lines changed

sprint_0/python/a.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1-
def add_two_numbers(A, B):
1+
from typing import Tuple
2+
3+
def add_two_numbers(A: int, B: int) -> int:
24
# Здесь реализация вашего решения
35
pass
46

5-
A = int(input())
6-
B = int(input())
7+
def read_input() -> Tuple[int, int]:
8+
A = int(input())
9+
B = int(input())
10+
return A, B
711

12+
A, B = read_input()
813
print(add_two_numbers(A, B))

sprint_0/python/b.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1-
def zipper(A, B):
1+
from typing import List, Tuple
2+
3+
def zipper(A: List[int], B: List[int]) -> List[int]:
24
# Здесь реализация вашего решения
35
pass
46

5-
n = int(input())
6-
A = list(map(int, input().strip().split()))
7-
B = list(map(int, input().strip().split()))
7+
def read_input() -> Tuple[List[int], List[int]]:
8+
n = int(input())
9+
A = list(map(int, input().strip().split()))
10+
B = list(map(int, input().strip().split()))
11+
return A, B
12+
13+
A, B = read_input()
814
print(" ".join(map(str, zipper(A, B))))

sprint_0/python/c.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1-
def moving_average(data, window_size):
1+
from typing import List, Tuple
2+
3+
def moving_average(data: List[int], window_size: int) -> List[float]:
24
# Здесь реализация вашего решения
35
pass
46

5-
n = int(input())
6-
data = list(map(int, input().strip().split()))
7-
window_size = int(input())
7+
def read_input() -> Tuple[List[int], int]:
8+
n = int(input())
9+
data = list(map(int, input().strip().split()))
10+
window_size = int(input())
11+
return data, window_size
12+
13+
data, window_size = read_input()
814
print(" ".join(map(str, moving_average(data, window_size))))

sprint_0/python/d.py

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
1-
def two_sum(numbers, required_sum):
1+
from typing import List, Tuple, Optional
2+
3+
def two_sum(numbers: List[int], required_sum: int) -> Optional[Tuple[int, int]]:
24
# Здесь реализация вашего решения
35
pass
46

5-
n = int(input())
6-
numbers = list(map(int, input().strip().split()))
7-
required_sum = int(input())
8-
result = two_sum(numbers, required_sum)
9-
if result is None:
10-
print(None)
11-
else:
12-
print(" ".join(map(str, result)))
7+
def read_input() -> Tuple[List[int], int]:
8+
n = int(input())
9+
numbers = list(map(int, input().strip().split()))
10+
required_sum = int(input())
11+
return numbers, required_sum
12+
13+
def print_result(result: Optional[Tuple[int, int]]) -> None:
14+
if result is None:
15+
print(None)
16+
else:
17+
print(" ".join(map(str, result)))
18+
19+
numbers, required_sum = read_input()
20+
print_result(two_sum(numbers, required_sum))

sprint_0/python/e.py

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
1-
def two_sum_2(numbers, required_sum):
1+
from typing import List, Tuple, Optional
2+
3+
def two_sum_fast(numbers: List[int], required_sum: int) -> Optional[Tuple[int, int]]:
24
# Здесь реализация вашего решения
35
pass
46

5-
n = int(input())
6-
numbers = list(map(int, input().strip().split()))
7-
required_sum = int(input())
8-
result = two_sum_2(numbers, required_sum)
9-
if result is None:
10-
print(None)
11-
else:
12-
print(" ".join(map(str, result)))
7+
def read_input() -> Tuple[List[int], int]:
8+
n = int(input())
9+
numbers = list(map(int, input().strip().split()))
10+
required_sum = int(input())
11+
return numbers, required_sum
12+
13+
def print_result(result: Optional[Tuple[int, int]]) -> None:
14+
if result is None:
15+
print(None)
16+
else:
17+
print(" ".join(map(str, result)))
18+
19+
numbers, required_sum = read_input()
20+
print_result(two_sum_fast(numbers, required_sum))

sprint_1_nonfinals/python/a.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
def get_quadratic_function_value(a, x, b, c):
1+
def get_quadratic_function_value(a: int, x: int, b: int, c: int) -> int:
22
# Здесь реализация вашего решения
33
pass
44

sprint_1_nonfinals/python/b.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
def is_same_parity(a, b, c):
1+
def is_same_parity(a: int, b: int, c: int) -> str:
22
# Здесь реализация вашего решения
33
pass
44

sprint_1_nonfinals/python/c.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
1-
def get_neighbours(matrix, row, column):
1+
from typing import List, Tuple
2+
3+
def get_neighbours(matrix: List[List[int]], row: int, column: int) -> List[int]:
24
# Здесь реализация вашего решения
35
pass
46

5-
n = int(input())
6-
m = int(input())
7-
matrix = []
8-
for i in range(n):
9-
matrix.append(list(map(int, input().strip().split())))
10-
row = int(input())
11-
column = int(input())
7+
def read_input() -> Tuple[List[List[int]], int, int]:
8+
n = int(input())
9+
m = int(input())
10+
matrix = []
11+
for i in range(n):
12+
matrix.append(list(map(int, input().strip().split())))
13+
row = int(input())
14+
column = int(input())
15+
return matrix, row, column
16+
17+
matrix, row, column = read_input()
1218
print(" ".join(map(str, get_neighbours(matrix, row, column))))

sprint_1_nonfinals/python/d.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1-
def weather_randomness(weather_data):
1+
from typing import List
2+
3+
def weather_randomness(weather_data: List[int]) -> int:
24
# Здесь реализация вашего решения
35
pass
46

5-
n = int(input())
6-
weather_data = list(map(int, input().strip().split()))
7+
def read_input() -> List[int]:
8+
n = int(input())
9+
weather_data = list(map(int, input().strip().split()))
10+
return weather_data
11+
12+
weather_data = read_input()
713
print(weather_randomness(weather_data))

sprint_1_nonfinals/python/e.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1-
def get_longest_word(text):
1+
def get_longest_word(text: str) -> str:
22
# Здесь реализация вашего решения
33
pass
44

5-
_ = input()
6-
text = input().strip()
7-
result = get_longest_word(text)
8-
print(result)
9-
print(len(result))
5+
def read_input() -> str:
6+
_ = input()
7+
text = input().strip()
8+
return text
9+
10+
def print_result(result: str) -> None:
11+
print(result)
12+
print(len(result))
13+
14+
print_result(get_longest_word(read_input()))

sprint_1_nonfinals/python/f.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
def is_palindrome(text):
1+
def is_palindrome(text: str) -> bool:
22
# Здесь реализация вашего решения
33
pass
44

sprint_1_nonfinals/python/g.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
def number_to_binary(number):
1+
def number_to_binary(number: int) -> str:
22
# Здесь реализация вашего решения
33
pass
44

5-
print(number_to_binary(input().strip()))
5+
def read_input() -> int:
6+
return int(input().strip())
7+
8+
print(number_to_binary(read_input()))

sprint_1_nonfinals/python/h.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1-
def add_two_numbers(A, B):
1+
from typing import Tuple
2+
3+
def add_two_numbers(A: str, B: str) -> str:
24
# Здесь реализация вашего решения
35
pass
46

5-
A = input().strip()
6-
B = input().strip()
7+
def read_input() -> Tuple[str, str]:
8+
A = input().strip()
9+
B = input().strip()
10+
return A, B
11+
12+
A, B = read_input()
713
print(add_two_numbers(A, B))

sprint_1_nonfinals/python/i.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
def is_power_of_4(number):
1+
def is_power_of_4(number: int) -> bool:
22
# Здесь реализация вашего решения
33
pass
44

sprint_1_nonfinals/python/j.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
def factorize(number):
1+
from typing import List
2+
3+
def factorize(number: int) -> List[int]:
24
# Здесь реализация вашего решения
35
pass
46

sprint_1_nonfinals/python/k.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1-
def add_two_numbers(digits, number):
1+
from typing import List, Tuple
2+
3+
def add_two_numbers(digits: List[int], number: int) -> List[int]:
24
# Здесь реализация вашего решения
35
pass
46

5-
n = int(input())
6-
digits = list(map(int, input().strip().split()))
7-
number = int(input())
7+
def read_input() -> Tuple[List[int], int]:
8+
n = int(input())
9+
digits = list(map(int, input().strip().split()))
10+
number = int(input())
11+
return digits, number
12+
13+
digits, number = read_input()
814
print(" ".join(map(str, add_two_numbers(digits, number))))

sprint_1_nonfinals/python/l.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1-
def find_excessive_letter(shorter, longer):
1+
from typing import Tuple
2+
3+
def find_excessive_letter(shorter: str, longer: str) -> str:
24
# Здесь реализация вашего решения
35
pass
46

5-
shorter = input().strip()
6-
longer = input().strip()
7+
def read_input() -> Tuple[str, str]:
8+
shorter = input().strip()
9+
longer = input().strip()
10+
return shorter, longer
11+
12+
shorter, longer = read_input()
713
print(find_excessive_letter(shorter, longer))

0 commit comments

Comments
 (0)