# Question 2: Complete the following Truth table: a b c...

• Lab Report
• 3

This preview shows page 1 - 3 out of 3 pages.

Lab # 3 (CPSC 111AV) Question 1: What do these expressions evaluate to? 1. 3 == 3 2. Hello == hel + lo 3. 3 != 3 4. 3 >= 4 5. not (3 < 4)
1 Question 2: Complete the following Truth table: a b c not a and b or c F F F F F T F T F F T T T F F T F T T T F T T T Question 3: Programming Questions: Team up with a classmate 1. Write a fruitful function sum_to(n) that returns the sum of all integer numbers up to and including n. So sum_to(10) would be 1+2+3...+10 which would return the value 55. Use the equation (n * (n + 1)) / 2 ? ? ? ? ? ? ? ? .
2 2. Write a function which is given an exam mark , and it returns a string the grade for that mark according to this scheme: Mark Grade >= 90 [80-90) [70-80) [60-70) < 60 Hint: The square and round brackets denote closed and open intervals. A closed interval includes the number, and open interval excludes it. So 79.99999 gets grade C , but 80 gets grade B. 3. Write a function find_hypot . The function will be given the length of two sides of a right-angled triangle and it should return the length of the hypotenuse . (Hint: x ** 0.5 will return the square root, or use sqrt from the A B C D F