πŸ’» Activity 3.1: Boolean Operations#

Booleans in Python are cast as 0 or 1. Replace ... with your code.

  1. Show the sum of two True values.

True ...
True + True
2
  1. Show the difference between False and True.

False - ...
False - True
-1
  1. What is the value of False times the sum of True and True?

...
False * (True + True)
0
  1. Show what happens to the datatype after two boolean values are added

print(type(False))
print(type(...))
print(type(False))
print(type(False + False))
<class 'bool'>
<class 'int'>
  1. Write code using only booleans, type(), and arithmetic operators that will result in the value 13 being printed when it is evaluated.

...
print(True * 13)
13
  1. Write code using only integers, type(), and logicals that will result in the value True being printed when it is evaluated.

...
print(1 == 1)
True