# Boolean Practice

Let’s try some simple practice problems. These problems are not graded - they are just for you to practice before doing the real exercises in the lab itself. You can find the answers below each question by clicking the button below each question.

What is printed to the terminal when the following Python program is run?

``````a = 5
b = 10
c = 15
x = b > a and c < b or (not (a + b > c))
y = b + a >= c or c / a > b / a
z = c - b != a and not c % a == 0
print(x)
print(y)
print(z)``````

Try to work out the solution yourself first before running the code.

What is printed to the terminal when the following Python program is run?

``````x = 7
y = 42
z = 6
a = x >= z and y <= x * z or not y % z == 0
b = not (y // x <= z or x - z > 0 or y % x != 1)
c = y // (z + x) < z / 2 and not bool(z)
print(a)
print(b)
print(c)``````

Try to work out the solution yourself first before running the code.

#### 4.3 Writing Code

Write a Python program that performs the following operations:

1. Prompts the user for four integer inputs and stores them in variables
2. If the first input is strictly smaller than all other inputs, and the last input is strictly larger than all other inputs, print `True`. If not, print `False`.

Your program may not use any conditional statements (if statements).

Hint: what comparisons must be made, and what comparisons do not need to be made, to answer these questions definitively?

#### 4.4 Writing Code

Write a complete program in Python that performs the following operations:

1. Prompts the user for three integer inputs and stores them in variables.
2. If the second and third inputs are multiples of the first, and the third input is a multiple of the second, print `true`. If not, print `false`.

Your program may not use any conditional statements (if statements).

Hint: you can use the modulo `%` operator to determine if one number is evenly divisible by another number. Can this also tell you which number is a multiple of another number?