1 задача:
import math
a=int(input())
b=int(input())
if(math.fabs(a+b)>20):
print(math.pow(a,2))
else:
b=math.fabs(b)
print(math.sqrt(b))
2 задача:
a=int(input())
if a == 5:
print("Отлично")
elif a == 4:
print("Хорошо")
elif a == 3:
print("Удовлетворительно")
elif a == 2:
print("Плохо")
elif a == 1:
print("Отвратительно")
else:
print("Это не оценка")
3 задача:
x=int(input())
y=int(input())
a=int(input())
b=int(input())
a7 = a%x
b7 = b%y
if(a7>b7):
print("7A")
else:
print("7Б")
4 задача:
import math
print("Введите интервал")
a=int(input())
b=int(input())
while(a<=b):
if a<100:
r=13*math.pow(a,2)
print("X=" + str(a) + " y=" + str(r))
elif a>100:
r=math.pow(a,3)-100
print("X=" + str(a) + " y=" + str(r))
else:
r=30-(a/(a-5))
print("X=" + str(a) + " y=" + str(r))
a=a+1
5 задача:
import math
print("Введите интервал")
a=int(input())
b=int(input())
while(a<=b):
if a<4:
r=3*a-7
print("X=" + str(a) + " y=" + str(r))
else:
r=5*math.pow(a,2)
print("X=" + str(a) + " y=" + str(r))
a=a+1
Объяснение:
отрезок
x1, y1,x2,y2 = map(int, input().split())
def nod(a, b):
--if b > 0:
return nod(b, a%b)
--else:
return a
a = abs(x1 - x2)
b = abs(y1 - y2)
d = nod(a, b)
print(d * (a//d + b//d - 1))
уравнение
def gcd(a, b):
while a != 0 and b != 0:
if a < b:
b = b % a
else:
a = a % b
return a + b
def qwer(a, b):
x = 1
x1 = 0
y = 0
y1 = 1
while b != 0:
q = a // b
r = a % b
x2 = x - q * x1
y2 = y - q * y1
a, b = b, r
x, x1 = x1, x2
y, y1 = y1, y2
return str(a), str(x), str(y)
a, b, c = list(map(int, input().split()))
x, y = 0, 0
gcds = 0
if c % gcd(a, b) != 0:
print('-1')
else:
gcds, x, y = map(int, qwer(a, b))
x *= c // gcds
y *= c // gcds
q = x // (b // gcds)
x %= b // gcds
y += a // gcds * q
print(x, y)