Condensed Hacks for U3
All the condensed hacks for unit 3
WGET LINKS
- https://raw.githubusercontent.com/The-Code-Monkeys/Monkeys38/main/_notebooks/2023-09-17-boolean-lesson.ipynb (boolean lesson)
- https://raw.githubusercontent.com/The-Code-Monkeys/Monkeys38/main/_notebooks/2023-09-19-logic-gates.ipynb (logic gates lesson)
Boolean and If Statements
Now that you know what boolean expressions are and how to write them, as well as several comparison methods, your task is to write a class that uses either the compareTo or comparator and compare. Then create two instances of these classes and demonstrate using if statements.
BONUS: Create a program that checks if a year is a leap year or not.
Here is how the method should work:
(1) Prompt the user to input any year that they would like
(2) Determine if the year is a leap year or not
(3) Print the necessary dialogue (ex. [year] is/is not a leap year) AND return the value of any boolean(s) used
## Boolean Logic
Complete the weird questions below.
Weird questions
- !(true)&&(false) = ? what in boolean values?
- not ((((true and not (false)) ^ false) ^ true) && false) (remember PEMDASNAO!)
-
Prove the following: !A * !(B + !C) = !A * (!B * C)
- 420 && 66 (Hint, convert to binary, then perform the operation)
- If you got this one, try 89 OR 42
For each example, you can use code, but then show your work and how you got it. Please ask questions if you are confused!.