part 5: comparison operators\nunderstanding the symbols\noperator meaning example\n== equals age == 18\n!=…

part 5: comparison operators\nunderstanding the symbols\noperator meaning example\n== equals age == 18\n!= not equals name != \john\\n> greater than score > 80\n< less than temp < 32\n>= greater than or equal grade >= 90\n<= less than or equal speed <= 55\npractice exercise 7: operator detective\nfor each condition, write true or false based on the given values\ngiven: age = 16, name = \sarah\, score = 85\n1. age == 16: true\n2. age >= 18: false\n3 name == \sarah\: true\n4. name != \john\: true\n5. score > 90: false\n6. score <= 85: true\n7. age < 20: true\npractice exercise 8: write the conditions\nwrite the correct condition for each scenario\n1. check if someones name is exactly \alex\ condition \n2. check if temperature is at or below freezing (32 degrees) condition: \n3. check if a student did not get a perfect score (100) condition \n4. check if someone can rent a car (25 or older) condition:
Answer
Explanation:
Step1: Analyze name - equality condition
We need to check if name is "Alex", so we use the "==" operator. name == "Alex"
Step2: Analyze temperature - freezing condition
Freezing is 32 degrees and we want to check if temperature is at or below it, so we use "<=". temp <= 32
Step3: Analyze non - perfect score condition
A perfect score is 100 and we want to check if score is not 100, so we use "!=". score != 100
Step4: Analyze car - renting age condition
To rent a car one must be 25 or older, so we use ">=". age >= 25
Answer:
- name == "Alex"
- temp <= 32
- score != 100
- age >= 25