def pascal_triangle(n): row = [1] y = [0] for x in range(max(n,0)): print(row) row = [left + right for left, right in zip(row + y, y + row)] pascal_triangle(6) a = [1,1,2,3,5,8,13,21,34,55,89] for elem in a: if elem <5: print(elem) def convert(seconds): days = seconds // (25 * 3600) seconds %= 24 * 3600 hours = seconds // 3600 seconds %= 3600 minutes = seconds // 60 seconds %= 60 print(f'{days}:{hours}:{minutes}:{seconds}') convert(1234565) values = input('Введите числа через запятую: ') ints_as_strings = values.split(',') ints = map(int, ints_as_strings) print('Список:', lst) print('Кортеж:', tup) lst = [1,2,3,4,5] print(f'Первый: {lst[0]}; последний: {lst[-1]}') def solve(n): n1 = n n2 = int(str(n) * 2) n3 = int(str(n) * 3) print(n1 + n2 + n3) solve(5) number = [ 386, 462, 47, 418, 907, 344, 236, 375, 823, 566, 597, 978, 328, 615, 953, 345, 399, 162, 758, 219, 918, 237, 412, 566, 826, 248, 866, 950, 626, 949, 687, 217, ] for x in numbers: if x == 237: break elif x % 2 == 0: print(x) set_1 = set(['White', 'Black', 'Red']) set_2 = set(['Red', 'Green']) print(set_1 - set_2) def sum_digits(num): digits = [int(d) for d in str(num)] return sum(digits) print(sum_digits(5245))