29.0k views
0 votes
Write an expression that evaluates to True if the int associated with width_of_box is not divisible (with no remainder) by the int associated with width_of_book . Assume that the latter is not zero.

Write an expression that evaluates to True if the int associated with width_of_box is not divisible (with no remainder) by the int associated with width_of_book . Assume that the latter is not zero.

User Rlorenzo
by
7.5k points

1 Answer

6 votes

Final answer:

The expression width_of_box % width_of_book != 0 checks if width_of_box is not divisible by width_of_book and evaluates to True if the remainder is not zero, indicating non-divisibility.

Step-by-step explanation:

An expression that evaluates to True if the integer associated with width_of_box is not divisible by the integer associated with width_of_book can be written using the modulus operator (%). The modulus operator gives the remainder of the division of two numbers. If width_of_box is not divisible by width_of_book, that means the remainder is not zero.

Therefore, the expression that checks for this condition would be width_of_box % width_of_book != 0. This expression will return True when the remainder is not zero, meaning the width_of_box is not completely divisible by the width_of_book.

User Hadronzoo
by
7.5k points
Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.