A. Introduction

While making decisions, we often need to compound multiple conditions. For instance, 1<x<10 requires x>1 AND x<10. How to say AND in Python? What about x>1 OR y<1?

B. Notes:

1. A boolean expression (or logical expression) evaluates to one of two states true or false. Python provides the boolean type that can be either set to **False** or **True**. Many functions and operations return boolean values.

The **not** keyword can also be used to inverse a boolean value.

**>>> ****not** True
False

The evaluation using the **and** and **or** operators follow these rules:

**and**and**or**both evaluate expressions from left to right while**and**have higher precedence.with

**and**, if all values are**True**, returns the last evaluated value. If any value is**False,**returns the first**False**value, and ignores the rest. This is called**short-circuit**.**or**returns the first**True**value, and ignores the rest(**short-circuit**). If all are**False**, returns the last**False**.

Summary:

```
x Returns True if x is True, False otherwise
x and y Returns x if x is False, y otherwise
x or y Returns y if x is False, x otherwise
```

2. __Examples__

3. Operator Precedence: See the table below. Highest precedence at the top, lowest at the bottom. Operators in the same box evaluate left to right.

C. Try this:

1. Let the user enter three side lengths of a triangle as input, print out if it is an equilateral, Isosceles, or scalene triangle.

2. Let the user enter measurements of a triangle's three interior angles as input, print out if it is an acute, right, or obtuse triangle.

a = int(input("Please enter length of side A: ")) b = int(input("Please enter length of side B: ")) c = int(input("Please enter length of side C: ")) if a == b == c: print("Equilateral") elif a == b or a == c or b == c: print("Isoceles") else: print("Scalene") a = int(input("Please enter measure of angle A: ")) b = int(input("Please enter measure of angle B: ")) c = int(input("Please enter measure of angle C: ")) if (a == 90 or b == 90 or c == 90) and a+b+c == 180: print("Right") elif (a > 90 or b > 90 or c > 90) and a+b+c == 180: print("Obtuse") elif a+b+c == 180: print("Acute")

print("Instructions:") print("\nAll you have to do is put in the \ninterior angles of your triangle\nand I will tell you what type of triangle it is.\n\n") a=int(input()) b=int(input()) c=int(input()) abc = a+b+c if abc==180: print("\nThe triangle you entered is a real triangle.") if a<=0 or b<=0 or c<=0: print("One of your angles are equal to or less than zero.\nThat is illegal. You will be arrested for not knowing that.") elif a+b+c!=180: print("\nPlease check all your angles to make sure\nare correct.") if a==b==c and abc==180: print("\nThe triangle you entered is an equilateral triangle.") if a==b and b!=c and abc==180: print("\nThe triangle you entered is a isosceles \ntriangle.") if a==c and c!=b and abc==180: print("\nThe triangle you entered is a isosceles \ntriangle.") if c==b and b!=a and abc==180: print("\nThe triangle you entered is a isosceles \ntriangle.") if a!=b and a!=c and c!=b and abc==180: print("\nThe triangle you entered is a scalene \ntriangle.") if abc!=180: print("\nALERT: The triangle you entered is no\n a valid email address") print("\n\nThank you for using Triangle Calculator \nby LuphADoff Incorporated.") if abc-abc==0: print("\n\n\nFun Face: LuphADoff is the best \nplace to find get high quality apps and stuff.")

the one with the lengths

print('here is a bot that depends not on the angles, but on the side length wowie') print("the only real difference there is is angles a+b+c=180 and the sides a+b>c and a+c>b and b+c>a") a=int(input()) b=int(input()) c=int(input()) if a+b>c and a+c>b and b+c>a: print("real triangle yay") else: print("not a triangle that exists😞") if a==b!=c or a==c!=b or c==b!=a and a+b>c and a+c>b and b+c>a: print("isosceles triangle") if a!=b!=c and a+b>c and a+c>b and b+c>a: print("scalene triangle") if a==b==c and a+b>c and a+c>b and b+c>a: print("equilateral triangle") else: print(" ")

hello aaaaaaaaaaaaaaaaaaaaa

print("triangle machine go brrr") print("type angles for a triangle and I will decide if it is isosceles, equilateral, scalene, or doesn't exist") a=int(input()) b=int(input()) c=int(input()) if a+b+c==180: print("real triangle") elif a>178 or b>178 or c>178: print('that triangle doesn\'t exist you imbecile') elif a+b+c!=180: print("make the angles = 180") if a==b==c and a+b+c==180: print("equilateral") if a!=b!=c and a+b+c==180: print("scaleneeeeeeee") if a==b!=c and a+b+c==180: print("isosceles") if a!=b==c and a+b+c==180: print("isosceles") if a==c!=b and a+b+c==180: print("isosceles") else: print(" ")