Last active
September 29, 2022 13:56
-
-
Save bannovGB/4b91f991abc61fa5c22f814158daad6c to your computer and use it in GitHub Desktop.
Python_ДЗ1
This file contains 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
# Напишите программу, которая принимает на вход цифру, обозначающую день недели | |
# и проверяет, является ли этот день выходным. | |
# Пример: - 6 -> да - 7 -> да - 1 -> нет | |
n = int(input("Ведеите день недели: ")) | |
if n < 1 or n > 7: | |
print("Вы ввели не корректный день") | |
elif n >= 1 and n <= 5: | |
print (n, "это будни") | |
else: | |
print(n, "это выходной") |
This file contains 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
# Напишите программу для. проверки истинности утверждения ¬(X ⋁ Y ⋁ Z) = ¬X ⋀ ¬Y ⋀ ¬Z для всех значений предикат. | |
for x in range (2): | |
for y in range (2): | |
for z in range (2): | |
print((x,y,z), not (x or y or z) == (not x and not y and not z)) |
This file contains 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
# Напишите программу, которая принимает на вход координаты точки (X и Y), причём X ≠ 0 и Y ≠ 0 | |
# и выдаёт номер четверти плоскости, в которой находится эта точка (или на какой оси она находится). | |
# Пример: | |
# - x=34; y=-30 -> 4 | |
# - x=2; y=4 -> 1 | |
# - x=-34; y=-30 -> 3 | |
x = int(input("Ведеите x: ")) | |
y = int(input("Ведеите y: ")) | |
if x < 0 and y < 0: | |
print("Точка в четверти №3") | |
elif x > 0 and y > 0: | |
print ("Точка в четверти №1") | |
elif x > 0 and y < 0: | |
print("Точка в четверти №4") | |
else: | |
print("Точка в четверти №2") |
This file contains 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
# Напишите программу, которая по заданному номеру четверти, показывает диапазон | |
# # возможных координат точек в этой четверти (x и y). | |
n = int(input("Ведеите номер четверти: ")) | |
if n<1 or n>4: | |
print("Вы ввели не корректный номер") | |
if n == 1: | |
print("x>0: y>0") | |
if n == 2: | |
print("x>0: y<0") | |
if n == 3: | |
print("x<0: y<0") | |
if n == 4: | |
print("x>0: y<0") |
This file contains 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
# Напишите программу, которая принимает на вход координаты двух точек | |
# и находит расстояние между ними в 2D пространстве. | |
# Пример: | |
# - A (3,6); B (2,1) -> 5,09 | |
# - A (7,-5); B (1,-1) -> 7,21 | |
Ax = float(input("Введите координату точки А по х: ")) | |
Ay = float(input("Введите координату точки A по y: ")) | |
Bx = float(input("Введите координату точки B по х: ")) | |
By = float(input("Введите координату точки B по y: ")) | |
S = ((Bx - Ax) ** 2 + (By - Ay) ** 2) ** 0.5 | |
print(round(S, 2)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment