diff --git a/content/posts/informatics/python-data-types-solution.mdx b/content/posts/informatics/python-data-types-solution.mdx index 0fcd726..190c004 100644 --- a/content/posts/informatics/python-data-types-solution.mdx +++ b/content/posts/informatics/python-data-types-solution.mdx @@ -88,6 +88,52 @@ print(min_integer(7, 12)) # Output: 7 ``` +2. Вычислить остаток от деления на 10 заданного трехзначного числа. + +```python + +def remainder_10(n): + return n % 10 + +print(remainder_10(456)) # Output: 6 + +``` + +3. Проверить, является ли заданное число нечетным. + + +```python + +def is_odd(n): + return n % 2 != 0 + +print(is_odd(9)) # Output: True + +``` + +4. Вычислить произведение двух целых чисел. + +```python + +def multiply(a, b): + return a * b + +print(multiply(5, 8)) # Output: 40 + +``` + +5. Проверить, является ли заданное число равным нулю. + +```python + +def is_zero(n): + return n == 0 + +print(is_zero(0)) # Output: True + +``` + + ## Урок 1.2 ## Задания для самостоятельной работы @@ -111,4 +157,15 @@ print(min_integer(2, 3, 4)) # Output: 24 ``` +2. Вычисление периметра прямоугольника по длинам двух сторон. + +```python + +def parallelepiped_volume(a, b, с): + return a * b * c + +print(min_integer(2, 3, 4)) # Output: 24 + +``` + [На главную](/) \ No newline at end of file