We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2cea477 commit 3a46af9Copy full SHA for 3a46af9
ch08-conditional-logic/2-add-some-logic.py
@@ -1,10 +1,22 @@
1
# 8.2 - Add Some Logic
2
# Solutions to review exercises
3
4
-
+# --- Exercise 1
5
# Test whether these expressions are True or False
6
7
print((1 <= 1) and (1 != 1))
8
print(not (1 != 2))
9
print(("good" != "bad") or False)
10
print(("good" != "Good") and not (1 == 1))
+
11
+# --- Exercise 2
12
+# Add parentheses so that the following expressions all
13
+# evaluate to True
14
15
+# False == not True
16
+print(False == (not True))
17
+# True and False == True and False
18
+print((True and False) == (True and False))
19
+# not True and "A" == "B"
20
+print(not (True and "A" == "B"))
21
+# "B" and not "A" != "B"
22
+print(("B" and not "A") != "B")
0 commit comments