This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tkinter as tk | |
import tkinter.font as tkfont | |
import tkinter.ttk as ttk | |
class App(tk.Tk): | |
def __init__(self): | |
super().__init__() | |
# --- Настройки окна ------------------------------------------------------------------------------------------- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tkinter as tk | |
# собственный класс для кнопки с особым функционалом под задачу | |
class MyButton(tk.Button): | |
# связь цветов элементов (противоположных) | |
transitions = {'yellow': 'red', | |
'blue': 'green'} | |
def __init__(self, *args, **kwargs): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Основная функция по условию. | |
def main(): | |
def stringToChemicals(string: str, symbols_list, result=''): | |
# Проверка на пустоту строку, актуально при последнем рекурсивном вызове | |
# когда функция доходит до конца строки, возвращая результат. | |
if not string: | |
return result | |
# Проверка на пробелы, при если текущий символ - пробел, возвращает | |
# саму себя, сдвигаясь на один символ дальше (срезом строки), добавляя | |
# пробел в результат. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Импортируем библиотеку re (Regular Expression, регулярный выражения) | |
import re | |
# Опередлем функцию main | |
def main(): | |
# Создаем временные переменные в локальной области видимости | |
instance = None | |
text = '' | |
# Определяем класс | |
class TextTools: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
massiv2 = [ | |
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], | |
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], | |
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], | |
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], | |
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], | |
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], | |
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], | |
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], | |
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
massiv1 = [ | |
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], | |
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], | |
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], | |
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], | |
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], | |
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], | |
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], | |
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], | |
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
massiv_kvadratov = [ | |
[0, 100, 400, 900, 1600, 2500, 3600, 4900, 6400, 8100], | |
[1, 121, 441, 961, 1681, 2601, 3721, 5041, 6561, 8281], | |
[4, 144, 484, 1024, 1764, 2704, 3844, 5184, 6724, 8464], | |
[16, 196, 576, 1156, 1936, 2916, 4096, 5476, 7056, 8836], | |
[25, 225, 625, 1225, 2025, 3025, 4225, 5626, 7225, 9025], | |
[36, 256, 676, 1296, 2116, 3136, 4356, 5776, 7396, 9216], | |
[49, 289, 729, 1369, 2209, 3249, 4489, 5929, 7569, 9409], | |
[64, 324, 784, 1444, 2304, 3364, 4624, 6084, 7744, 9604], | |
[81, 361, 841, 1521, 2401, 3481, 4761, 6241, 7921, 9801] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
day = int(input('Введите день: ')) | |
month = int(input('Введите месяц: ')) | |
year = int(input('Введите год: ')) | |
# Количество дней, уже прошедших, до определенного месяца: | |
days_before_month = (0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334) | |
# Проверка на високосность, для месяцев до марта добавление +1 дня не актуально: | |
if month > 2 and year % 4 == 0 or year % 100 == 0 and year % 400 == 0: | |
print(days_before_month[month - 1] + day + 1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def sravnenie(a, b): | |
if a > b: | |
print(f'{a} больше {b}') | |
elif b > a: | |
print(f'{b} больше {a}') | |
else: | |
print(f'{a} равно {b}') | |
def mediana(a, b, c): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def ordinalDate(day, month, year): | |
day = int(day) | |
month = int(month) | |
year = int(year) | |
# Находим сколько дней в году, проверяя на високосность | |
if year % 4 == 0 and year % 100 != 0 or year % 400 == 0: | |
feb = 29 | |
else: |
NewerOlder