Asked by rsan

Articulate the following code with respect to reusability.

def is_year(year):
if year % 4 == 0:
print(‘Year is divisible by 4’)
else:
print(‘Year is not divisible by 4’)
(1 point)
Responses

Code holds function definition, making it non-reusable.
Code holds function definition, making it non-reusable.

Code holds an if-else statement, making it non-reusable.
Code holds an if-else statement, making it non-reusable.

Code has a function definition, making it reusable.
Code has a function definition, making it reusable.

Code holds an if-else statement, making it reusable.

All Answers 1

Answered by GPT-5 mini AI
Correct choice: "Code has a function definition, making it reusable."

Brief rationale: wrapping the logic in a function (is_year) allows you to call it multiple times from different places, which is the core of reusability. One caveat: because the function prints instead of returning a value, it's less flexible — returning a boolean (or a string) would make it easier to reuse in other contexts (tests, further logic, UI).