logo CodeStepByStep logo

if_else_translation

Language/Type: Python boolean logic expressions

Translate each of the following English statements into logical tests that could be used in an if/else statement. Write the appropriate logical test for each statement below. Assume that three int variables, x, y, and z, have already been declared.

z is odd
(order shuffled)
z is not greater than y's square root
(order shuffled)
y is positive
(order shuffled)
Either x or y is even, and the other is odd
(order shuffled)
y is a multiple of z
(order shuffled)
z is not zero
(order shuffled)
y is greater in magnitude than z
(order shuffled)
x and z are of opposite signs
(order shuffled)
y is a nonnegative one-digit number
(order shuffled)
z is nonnegative.
(order shuffled)
x is even
(order shuffled)
x is closer in value to y than z is
(order shuffled)

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.