1. For these problems, a Boolean expression: means an expression like “2 < x <=
ID: 3756845 • Letter: 1
Question
1. For these problems, a Boolean expression: means an expression like “2 < x <= 4” or “5 < x and y > 2”
a. If r and s are both numbers: write the Boolean expression that will make the statement that (r – s) is greater than -4 and less than 5.
b. if r = 8 and s = 2, what value would Python assign to the expression you wrote in part a. ?
c. if x = 5, y = 2, and z = False, what value will Python return if you type in this sentence: z == True and x < 4 or y >1
d. Write one Boolean expression that says the numbers n and r are both between 1 and 6 inclusive.
e. Write one Boolean expression that says the numbers n and r are either or both less than or equal to 4
Explanation / Answer
A. -4<(r-s)<5
B. False because as per equation in a 4<(r-s)<5 we evaluate as (r-s)=8-2=6. So, 6 is not between -3 and 4.
C. False
D. "1<=n<=6" and "1<=r<=6".
E. "n<=4 or r<=4" or "n<=4 and r<=4".
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.