Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def task1():
- list_of_numbers = [
- 10, 25, 36, -54, 28, 68, -5, -84, 84, -69,
- -22, 16, -63, 87, 53, 21, 66, -4, 77, 87,
- 48, 62, -93, -14, 8, 34, 9, 21, -14, 78,
- 36, -26, -49, -90, 94, 74, -17, 7, 3, 93,
- 12, 40, -37, 81, 69, -94, 67, 32, 92, 9,
- 46, 61, -12, 67, -75, 7, -41, -84, -82, 19,
- -6, 5, -70, -45, 55, -27, -91, -70, -42, 84,
- 55, 21, 39, 54, 10, 32, 57, -26, 34, 32,
- 75, 69, 50, -86, -18, -1, 42, 97, 60, 87,
- 36, 8, 99, -17, -43, 49, 95, -72, -88, -89, -24, 27, -86]
- num = int(input("Введите число"))
- if num in list_of_numbers:
- print(f'Таких чисел в спике - {list_of_numbers.count(num)}')
- else:
- print(f'Максимальное число - {max(list_of_numbers)}')
- def task2():
- s1 = input()
- s2 = input()
- final = [s1[i:b + 1] for i in range(len(s1)) for b in range(len(s1))]
- arr = [i for i in final if i in s1 and i in s2 and len(i) > 1]
- last_word = ""
- for substring in arr:
- count = 0
- for ch in substring:
- if ch == "":
- continue
- if substring.count(ch) == 1:
- count += 1
- if count > len(last_word):
- last_word = substring
- print(last_word)
- def task3():
- s = input()
- out = ""
- for i in range(len(s)):
- if i % 2:
- out += s[i].lower()
- else:
- out += s[i].upper()
- print(out)
- def task4():
- def PointOnTriangle(x, y, triangle):
- x1, y1 = triangle[0]
- x2, y2 = triangle[1]
- x3, y3 = triangle[2]
- sign1 = (x1 - x) * (y2 - y1) - (x2 - x1) * (y1 - y)
- sign2 = (x2 - x) * (y3 - y2) - (x3 - x2) * (y2 - y)
- sign3 = (x3 - x) * (y1 - y3) - (x1 - x3) * (y3 - y)
- if(sign1 > 0 and sign2 > 0 and sign3 > 0 or sign1 < 0 and sign2 < 0 and sign3 < 0):
- return True
- return False
- def getTriangle():
- t = []
- for i in range(3):
- str = input(f"Введите {i+1} вершину - x, y. Через пробел").split(" ")
- if str[0] == "":
- str = str[1:]
- t.append([int(str[0]), int(str[1])])
- return t
- print("Введите первый треуголник")
- triangle1 = getTriangle()
- print("Введите второй треуголник")
- triangle2 = getTriangle()
- for point in triangle1:
- if PointOnTriangle(*point, triangle2) == False:
- break
- elif triangle1.index(point) == 2:
- print("Первый треуголник во втором")
- for point in triangle2:
- if PointOnTriangle(*point, triangle1) == False:
- break
- elif triangle2.index(point) == 2:
- print("Второй треуголник в первом")
- task1()
- task2()
- task3()
- task4()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement