ohwhatalovelyday

Untitled

Jul 4th, 2023
905
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.53 KB | None | 0 0
  1. import string
  2.  
  3.  
  4. def task1() -> bool:
  5.     return True
  6.  
  7.  
  8. def task2() -> bool:
  9.     password1 = input()
  10.     password2 = input()
  11.     return password1 == password2  # False
  12.  
  13.  
  14. def task3() -> int:
  15.     a = int(input())
  16.     b = int(input())
  17.     c = int(input())
  18.     d = int(input())
  19.     return min(a, b, c, d)
  20.  
  21.  
  22. def task4() -> int:
  23.     a = int(input())
  24.     b = int(input())
  25.     c = int(input())
  26.     d = int(input())
  27.     return max(a, b, c, d)
  28.  
  29.  
  30. def task5() -> bool:
  31.     a = int(input())
  32.     b = int(input())
  33.     c = int(input())
  34.     return (a < (b + c)) and (b < (a + c)) and (c < (a + b))
  35.  
  36.  
  37. def task6() -> string:
  38.     a = int(input())
  39.     b = int(input())
  40.     c = int(input())
  41.     if not((a < (b + c)) and (b < (a + c)) and (c < (a + b))):
  42.         return 'вырожденный'
  43.     if a == b and a == c and b == c:
  44.         return 'равносторонний'
  45.     if (a == b and a != c) or (b == c and a != b) or (c == a and a != b):
  46.         return 'равнобедренный'
  47.     return 'разносторонний'
  48.  
  49.  
  50. def task7() -> int:
  51.     a = int(input())
  52.     b = int(input())
  53.     c = int(input())
  54.     d = int(input())
  55.     if c < a:   # инвариант: первый отрезок всегда левее
  56.         a, c = c, a
  57.         b, d = d, b
  58.     length = min(b, d) - max(a, c) + 1
  59.     return length
  60.  
  61.  
  62. def main():
  63.     print(task1())
  64.     print(task2())
  65.     print(task3())
  66.     print(task4())
  67.     print(task5())
  68.     print(task6())
  69.     print(task7())
  70.  
  71.  
  72. if __name__ == '__main__':
  73.     main()
  74.  
Advertisement
Add Comment
Please, Sign In to add comment