Skip to content

Instantly share code, notes, and snippets.

@Denkotleta221
Created January 30, 2025 21:01
Show Gist options
  • Save Denkotleta221/e3b60bcb445c36cc008ebfbd648a884e to your computer and use it in GitHub Desktop.
Save Denkotleta221/e3b60bcb445c36cc008ebfbd648a884e to your computer and use it in GitHub Desktop.
# 1) Task
# def draw_line(len: int, item: str, is_work: bool):
# if is_work:
# for n in range(1, len + 1):
# print(f"{item}")
# else:
# print(f"{len * item}")
# func = draw_line(20, '!', True)
# print(func)
# 2) Task
# def draw_rectangle(width = 4, height = 4, border = '|', fill = '-'):
# print(border * width)
# for n in range(height - 2):
# print(border + fill * (width - 2) + border)
# print(border * width)
# draw_rectangle()
# draw_rectangle(20, 10, '#', '|')
# 3) Task
# def is_siple(num: int) -> bool:
# if num < 2:
# return False
# for n in range(2, int(num ** 0.5), + 1):
# if num % n == 0:
# return False
# return True
# print(is_siple(12))
# print(is_siple(7))
# 4) Task
# def sum_diapason(num1: int, num2: int):
# start = min(num1, num2)
# end = max(num1, num2)
# sum1 = sum(range(start, end + 1))
# sum2 = (sum1 - num1) - num2
# return sum2
# print(sum_diapason(1, 5))
# 5) Task
# numbers = [3, 3, 3, 10, 10, 10]
# def sum_list(num_list: list):
# sum = 0
# for n in num_list:
# sum += n
# return sum
# print(sum_list(numbers))
# 6) Task
# def find_min_max(num_list: list):
# min_value = min(num_list)
# max_value = max(num_list)
# min_index = num_list.index(min_value)
# max_index = num_list.index(max_value)
# print(f"Min value {min_value} - index {min_index}")
# print(f"Max value {max_value} - index {max_index}")
# numbers = [6, 334, 11, 44, 120, 33, 44, 91, 33, 419, 85, 69]
# print(find_min_max(numbers))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment