Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- print("Lab_2 / 16var")
- print("Task 1")
- while True:
- n1 = input("Enter n1: ")
- n2 = input("Enter n2: ")
- if (n1.isdigit() and n2.isdigit()):
- n1 = int(n1)
- n2 = int(n2)
- break
- else:
- print("Enter an integer")
- if (n1 * n2 < 0 and n1 * n2 <= 1):
- print("Code branch: 0<n1*n2<=1")
- rez = math.exp(n1 + n2) * math.sqrt(math.fabs(2 * n1 - 5 * n2 ** 2))
- print("Result: ", rez)
- elif (n1 * n2 > 1):
- print("Code branch: n1*n2>1")
- rez = math.exp(n1 - n2) * math.sqrt(math.fabs(2 * n1 ** 2 + 5 * n2))
- print("Result: ", rez)
- else:
- print("Does not satisfy condition")
- print("Task 2")
- while True:
- try:
- x = int(input("Enter x: "))
- y = int(input("Enter y: "))
- break
- except ValueError:
- print("Enter an integer")
- if (x > 0 and y > 0):
- print("4 quadrant")
- elif (x < 0 and y > 0):
- print("3 quadrant")
- elif (x < 0 and y < 0):
- print("2 quadrant")
- elif (x > 0 and y < 0):
- print("1 quadrant")
- if (x == 0 and y == 0):
- print("The point lies at the intersection of the x and y axes")
- elif (x == 0):
- print("The point lies on the x-axis")
- elif (y == 0):
- print("The point lies on the y-axis")
Add Comment
Please, Sign In to add comment