8000 Add solutions to exercise 8.2.2 · pbt001/python-basics-exercises@3a46af9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3a46af9

Browse files
committed
Add solutions to exercise 8.2.2
1 parent 2cea477 commit 3a46af9

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed
Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,22 @@
11
# 8.2 - Add Some Logic
22
# Solutions to review exercises
33

4-
4+
# --- Exercise 1
55
# Test whether these expressions are True or False
6-
76
print((1 <= 1) and (1 != 1))
87
print(not (1 != 2))
98
print(("good" != "bad") or False)
109
print(("good" != "Good") and not (1 == 1))
10+
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

Comments
 (0)
0