Xom9ik

Lab_2/16var (IV semester) .py

Mar 13th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.24 KB | None | 0 0
  1. import math
  2.  
  3. print("Lab_2 / 16var")
  4. print("Task 1")
  5. while True:
  6.     n1 = input("Enter n1: ")
  7.     n2 = input("Enter n2: ")
  8.     if (n1.isdigit() and n2.isdigit()):
  9.         n1 = int(n1)
  10.         n2 = int(n2)
  11.         break
  12.     else:
  13.         print("Enter an integer")
  14.  
  15. if (n1 * n2 < 0 and n1 * n2 <= 1):
  16.     print("Code branch: 0<n1*n2<=1")
  17.     rez = math.exp(n1 + n2) * math.sqrt(math.fabs(2 * n1 - 5 * n2 ** 2))
  18.     print("Result: ", rez)
  19. elif (n1 * n2 > 1):
  20.     print("Code branch: n1*n2>1")
  21.     rez = math.exp(n1 - n2) * math.sqrt(math.fabs(2 * n1 ** 2 + 5 * n2))
  22.     print("Result: ", rez)
  23. else:
  24.     print("Does not satisfy condition")
  25.  
  26. print("Task 2")
  27.  
  28. while True:
  29.     try:
  30.         x = int(input("Enter x: "))
  31.         y = int(input("Enter y: "))
  32.         break
  33.     except ValueError:
  34.         print("Enter an integer")
  35.  
  36. if (x > 0 and y > 0):
  37.     print("4 quadrant")
  38. elif (x < 0 and y > 0):
  39.     print("3 quadrant")
  40. elif (x < 0 and y < 0):
  41.     print("2 quadrant")
  42. elif (x > 0 and y < 0):
  43.     print("1 quadrant")
  44.  
  45. if (x == 0 and y == 0):
  46.     print("The point lies at the intersection of the x and y axes")
  47. elif (x == 0):
  48.     print("The point lies on the x-axis")
  49. elif (y == 0):
  50.     print("The point lies on the y-axis")
Add Comment
Please, Sign In to add comment