Brief
Write a simple function, give it different values, and reuse its result without confusing calculation with proof.
Imani will receive three packets of authorized copies before a fictional deadline. A has 5 rows for 4 distinct IDs; B has 3 rows for 3 IDs; C has 7 rows for 5 IDs. Voss calls every extra row evidence against you. Mara asks for a repeatable calculation and a sentence explaining what it cannot prove.
Your mission
- Write
repetitions(rows, distinct)with a local variable andreturn. - Call it for A, B, and C and give three results.
- Explain how
returndiffers fromprint(). - If the function is in
inventory.py, write the import and a careful conclusion for Imani.
How to check your work
- Your function calculates
rows - distinctand returns it. - You get 1 for A, 0 for B, and 2 for C.
- You know
returngives a value to the caller;printonly displays. - You write
from inventory import repetitionsand do not turn extra rows into a verdict.
Course example
def repetitions(rows, distinct):
extra = rows - distinct
return extra
first_batch = repetitions(4, 3)
second_batch = repetitions(6, 4)
print(first_batch)
print(second_batch)