CSCI 150 HW: Boolean Practice
Due: Monday, September 16
To receive credit, for each exercise you should do the following:
-
Predict: First, complete the exercise without using the
Python interpreter.
-
Check: Run the code in a Kaggle notebook. Does the actual
output agree with what you wrote down in step 1?
-
Evaluate: If your answer in step 1 was different than the
actual output, keep experimenting with it, consult an online
reference, ask a friend or TA or professor, etc. until you can
explain why the code works the way it does and what your
misunderstanding(s) were in part 1.
For each expression, decide whether it will evaluate to True
or
False
.
False and (True or False)
(True and (not (False or False))) and (False or (True or False))
3 ** 2 + 4 ** 2 == 5 ** 2
50 < 99 / 3
((1 < 2) and ("hi" > "there")) or (99 != 9)
"egg" < "excellent"
"arm" < "aardvark"
False != (True != (False != (False != True)))
Your solution should be hand-written (or typed) and contain the following:
- For each line of code above, write down your original prediction.
- If your check (step 2) matched, put a check mark. Otherwise, put an X.
- If you wrote an X, then write a brief sentence explaining what you got wrong initially and why the code produces the answer it does.
Specifications
- To be considered complete you must work each given problem, and you must have the correct answer (after step 2 if needed), along with correct explanations where appropriate.