diff --git a/lesson2.2_1.py b/lesson2.2_1.py new file mode 100644 index 0000000..fb2969e --- /dev/null +++ b/lesson2.2_1.py @@ -0,0 +1,10 @@ +'''****** Задание ******** + *Просто здравствуй, просто как дела. +''' +name = input('Как Вас зовут?\n') +print(f'Здравствуйте, {name}!') +answer = input('Как дела?\n') +if answer == 'хорошо': + print('Я за Вас рада!') +if answer == 'плохо': + print('Всё наладится!') \ No newline at end of file diff --git a/lesson2.2_10.py b/lesson2.2_10.py new file mode 100644 index 0000000..3d1044c --- /dev/null +++ b/lesson2.2_10.py @@ -0,0 +1,12 @@ +'''****** Задание ******** + *Лучшая защита — шифрование. +''' +num = int(input()) +first = num // 10 +last = num % 100 +sum1 = first // 10 + first % 10 +sum2 = last // 10 + last % 10 +if sum1 < sum2: + print(str(sum2) + str(sum1)) +else: + print(str(sum1) + str(sum2)) \ No newline at end of file diff --git a/lesson2.2_11.py b/lesson2.2_11.py new file mode 100644 index 0000000..35cbd3c --- /dev/null +++ b/lesson2.2_11.py @@ -0,0 +1,17 @@ +'''****** Задание ******** + *Красота спасёт мир. +''' +num = int(input()) +first = num // 100 +second = num // 10 % 10 +third = num % 10 +if max(first, second, third) != first and min(first, second, third) != first: + middle = first +elif max(first, second, third) != second and min(first, second, third) != second: + middle = second +else: + middle = third +if max(first, second, third) + min(first, second, third) == middle * 2: + print('YES') +else: + print('NO') \ No newline at end of file diff --git a/lesson2.2_12.py b/lesson2.2_12.py new file mode 100644 index 0000000..4363133 --- /dev/null +++ b/lesson2.2_12.py @@ -0,0 +1,11 @@ +'''****** Задание ******** + *Музыкальный инструмент. +''' +first = int(input()) +second = int(input()) +third = int(input()) +summa = first + second + third +if max(first, second, third) * 2 < summa: + print('YES') +else: + print('NO') \ No newline at end of file diff --git a/lesson2.2_13.py b/lesson2.2_13.py new file mode 100644 index 0000000..4ccaaef --- /dev/null +++ b/lesson2.2_13.py @@ -0,0 +1,12 @@ +'''****** Задание ******** + *Властелин Чисел: Братство общей цифры. +''' +elves = int(input()) +dwarfs = int(input()) +humans = int(input()) +if elves // 10 == dwarfs // 10 == humans // 10: + print(elves // 10) +elif elves % 10 == dwarfs % 10 == humans % 10: + print(elves % 10) +else: + print('NO') \ No newline at end of file diff --git a/lesson2.2_14.py b/lesson2.2_14.py new file mode 100644 index 0000000..702319c --- /dev/null +++ b/lesson2.2_14.py @@ -0,0 +1,20 @@ +'''****** Задание ******** + *Властелин Чисел: Две Башни. +''' +num = int(input()) +first = num // 100 +second = num // 10 % 10 +third = num % 10 +if first > second: + first, second = second, first +if first > third: + first, third = third, first +if second > third: + second, third = third, second +minimal = first * 10 + second +if minimal < 10: + minimal = second * 10 + 0 +if minimal < 10: + minimal = third * 10 + 0 +maximal = third * 10 + second +print(minimal, maximal) \ No newline at end of file diff --git a/lesson2.2_15.py b/lesson2.2_15.py new file mode 100644 index 0000000..a341ab6 --- /dev/null +++ b/lesson2.2_15.py @@ -0,0 +1,14 @@ +'''****** Задание ******** + *Властелин Чисел: Возвращение Цезаря. +''' +num1 = int(input()) +num2 = int(input()) +a = num1 // 10 +b = num1 % 10 +c = num2 // 10 +d = num2 % 10 +summa = a + b + c + d +minimum = min(a, b, c, d) +maximum = max(a, b, c, d) +middle = (summa - minimum - maximum) % 10 +print(maximum * 100 + middle * 10 + minimum) \ No newline at end of file diff --git a/lesson2.2_16.py b/lesson2.2_16.py new file mode 100644 index 0000000..36c7da8 --- /dev/null +++ b/lesson2.2_16.py @@ -0,0 +1,31 @@ +'''****** Задание ******** + *Легенды велогонок возвращаются: кто быстрее? +''' +petya = int(input()) +vasya = int(input()) +tolya = int(input()) +first = max(petya, vasya, tolya) +third = min(petya, vasya, tolya) +second = petya + vasya + tolya - first - third +if first == petya: + first_name = 'Петя' +elif first == vasya: + first_name = 'Вася' +else: + first_name = 'Толя' +if second == petya: + second_name = 'Петя' +elif second == vasya: + second_name = 'Вася' +else: + second_name = 'Толя' +if third == petya: + third_name = 'Петя' +elif third == vasya: + third_name = 'Вася' +else: + third_name = 'Толя' +print(f'{first_name: ^24}') +print(f'{second_name: ^8}{" ": ^16}') +print(f'{" ": ^16}{third_name: ^8}') +print(f'{"II": ^8}{"I": ^8}{"III": ^8}') \ No newline at end of file diff --git a/lesson2.2_17.py b/lesson2.2_17.py new file mode 100644 index 0000000..17bf12d --- /dev/null +++ b/lesson2.2_17.py @@ -0,0 +1,25 @@ +'''****** Задание ******** + *Корень зла. +''' +a = float(input()) +b = float(input()) +c = float(input()) +d = float(b * b - 4 * a * c) +if a == b == c == 0: + print('Infinite solutions') +elif a == b == 0 and c != 0: + print('No solution') +elif a == 0 and b != 0: + x = float(-c / b) + print(f"{x:.2f}") +elif d < 0: + print('No solution') +elif d == 0: + x = float((-b) / (2 * a)) + print(f"{x:.2f}") +else: + x_1 = float(((-b) + (d ** 0.5)) / (2 * a)) + x_2 = float(((-b) - (d ** 0.5)) / (2 * a)) + min_x = min(x_1, x_2) + max_x = max(x_1, x_2) + print(f"{min_x:.2f} {max_x:.2f}") \ No newline at end of file diff --git a/lesson2.2_18.py b/lesson2.2_18.py new file mode 100644 index 0000000..562bb88 --- /dev/null +++ b/lesson2.2_18.py @@ -0,0 +1,14 @@ +'''****** Задание ******** + *Территория зла. +''' +a = int(input()) +b = int(input()) +c = int(input()) +maximum = max(a, b, c) ** 2 * 2 +other = a ** 2 + b ** 2 + c ** 2 +if maximum == other: + print('100%') +elif maximum > other: + print('велика') +else: + print('крайне мала') \ No newline at end of file diff --git a/lesson2.2_19.py b/lesson2.2_19.py new file mode 100644 index 0000000..c441037 --- /dev/null +++ b/lesson2.2_19.py @@ -0,0 +1,33 @@ +'''****** Задание ******** + *Автоматизация безопасности. +''' +x = float(input()) +y = float(input()) +r1 = 5 +r2 = 10 +c1 = (x ** 2 + y ** 2) ** 0.5 +c2 = (x ** 2 + y ** 2) ** 0.5 +y_para = (0.25 * (x ** 2)) + (0.5 * x) + 8.75 +if x >= 0 and y >= 0: + if c1 <= r1: + print("Опасность! Покиньте зону как можно скорее!") + elif c2 > r2: + print("Вы вышли в море и рискуете быть съеденным акулой!") + else: + print("Зона безопасна. Продолжайте работу.") +elif x <= 0 and y >= 0: + if y <= 5 and y <= ((5 * x) + 35) / 3: + print("Опасность! Покиньте зону как можно скорее!") + elif c2 > r2: + print("Вы вышли в море и рискуете быть съеденным акулой!") + else: + print("Зона безопасна. Продолжайте работу.") +elif (x >= 0 and y <= 0) or (x <= 0 and y <= 0): + if y < y_para: + print("Опасность! Покиньте зону как можно скорее!") + elif c2 > r2: + print("Вы вышли в море и рискуете быть съеденным акулой!") + else: + print("Зона безопасна. Продолжайте работу.") +elif x == 0 and y == 0: + print("Опасность! Покиньте зону как можно скорее!") \ No newline at end of file diff --git a/lesson2.2_2.py b/lesson2.2_2.py new file mode 100644 index 0000000..75deb14 --- /dev/null +++ b/lesson2.2_2.py @@ -0,0 +1,9 @@ +'''****** Задание ******** + *Кто быстрее? +''' +p_speed = int(input()) +v_speed = int(input()) +if p_speed > v_speed: + print('Петя') +else: + print('Вася') \ No newline at end of file diff --git a/lesson2.2_20.py b/lesson2.2_20.py new file mode 100644 index 0000000..31c96b8 --- /dev/null +++ b/lesson2.2_20.py @@ -0,0 +1,24 @@ +'''****** Задание ******** + *Зайка — 2. +''' +text_1 = input() +text_2 = input() +text_3 = input() +if 'зайка' in text_1 and 'зайка' in text_2 and 'зайка' in text_3: + minimum = min(text_1, text_2, text_3) + print(minimum, len(minimum)) +elif 'зайка' in text_1 and 'зайка' in text_2: + minimum = min(text_1, text_2) + print(minimum, len(minimum)) +elif 'зайка' in text_1 and 'зайка' in text_3: + minimum = min(text_1, text_3) + print(minimum, len(minimum)) +elif 'зайка' in text_2 and 'зайка' in text_3: + minimum = min(text_2, text_3) + print(minimum, len(minimum)) +elif 'зайка' in text_1 and 'зайка' not in text_2 and 'зайка' not in text_3: + print(text_1, len(text_1)) +elif 'зайка' in text_2 and 'зайка' not in text_1 and 'зайка' not in text_3: + print(text_2, len(text_2)) +elif 'зайка' in text_3 and 'зайка' not in text_1 and 'зайка' not in text_2: + print(text_3, len(text_3)) \ No newline at end of file diff --git a/lesson2.2_3.py b/lesson2.2_3.py new file mode 100644 index 0000000..8541da4 --- /dev/null +++ b/lesson2.2_3.py @@ -0,0 +1,12 @@ +'''****** Задание ******** + *Кто быстрее на этот раз? +''' +p_speed = int(input()) +v_speed = int(input()) +t_speed = int(input()) +if p_speed > v_speed and p_speed > t_speed: + print("Петя") +elif v_speed > p_speed and v_speed > t_speed: + print("Вася") +else: + print("Толя") \ No newline at end of file diff --git a/lesson2.2_4.py b/lesson2.2_4.py new file mode 100644 index 0000000..ff103ee --- /dev/null +++ b/lesson2.2_4.py @@ -0,0 +1,21 @@ +'''****** Задание ******** + *Список победителей. +''' +name1 = 'Петя' +name2 = 'Вася' +name3 = 'Толя' +time1 = int(input()) +time2 = int(input()) +time3 = int(input()) +if time1 < time2: + time1, time2 = time2, time1 + name1, name2 = name2, name1 +if time1 < time3: + time1, time3 = time3, time1 + name1, name3 = name3, name1 +if time2 < time3: + time2, time3 = time3, time2 + name2, name3 = name3, name2 +print('1.', name1) +print('2.', name2) +print('3.', name3) \ No newline at end of file diff --git a/lesson2.2_5.py b/lesson2.2_5.py new file mode 100644 index 0000000..773fabd --- /dev/null +++ b/lesson2.2_5.py @@ -0,0 +1,13 @@ +'''****** Задание ******** + *Яблоки. +''' +petya = 7 +vasya = 6 +n_apples = int(input()) +m_apples = int(input()) +petya = petya - 3 + 2 + n_apples +vasya = vasya + 3 + 5 - 2 + m_apples +if petya > vasya: + print('Петя') +elif vasya > petya: + print('Вася') \ No newline at end of file diff --git a/lesson2.2_6.py b/lesson2.2_6.py new file mode 100644 index 0000000..6e36500 --- /dev/null +++ b/lesson2.2_6.py @@ -0,0 +1,8 @@ +'''****** Задание ******** + *Сила прокрастинации. +''' +year = int(input()) +if year % 4 or not year % 100 and year % 400: + print('NO') +else: + print('YES') \ No newline at end of file diff --git a/lesson2.2_7.py b/lesson2.2_7.py new file mode 100644 index 0000000..b008c3a --- /dev/null +++ b/lesson2.2_7.py @@ -0,0 +1,8 @@ +'''****** Задание ******** + *А роза упала на лапу Азора. +''' +num = int(input()) +if num // 1000 == num % 10 and num % 1000 // 100 == num % 100 // 10: + print('YES') +else: + print('NO') \ No newline at end of file diff --git a/lesson2.2_8.py b/lesson2.2_8.py new file mode 100644 index 0000000..c5f01bd --- /dev/null +++ b/lesson2.2_8.py @@ -0,0 +1,8 @@ +'''****** Задание ******** + *Зайка — 1. +''' +text = input() +if 'зайка' in text: + print('YES') +else: + print('NO') \ No newline at end of file diff --git a/lesson2.2_9.py b/lesson2.2_9.py new file mode 100644 index 0000000..1e748e8 --- /dev/null +++ b/lesson2.2_9.py @@ -0,0 +1,12 @@ +'''****** Задание ******** + *Первому игроку приготовиться. +''' +first = input() +second = input() +third = input() +if first < second and first < third: + print(first) +elif second < first and second < third: + print(second) +elif third < first and third < second: + print(third) \ No newline at end of file