My for loop that has for value1, value2 in args is failing and I'm not sure why.
def school_completion(*args):
"""
If any of the subjects have one or more incomplete testlet, the whole school is
incomplete.
:param args: tuple of 7 strs
Should come as:
(Eligible Students,
ELA Required,
ELA Completed,
Math Required,
Math Completed,
Science Required,
Science Completed)
:return: str
"""
# If there are no eligible students, return a dash.
if args[0] == '0':
return '-'
# Set a boolean trigger.
complete = True
# Check for each subject pair.
for required,completed in args[1:]:
if required != completed:
complete = False
return 'Complete' if complete else 'Follow Up'
school_completion('1','6','6','7','7','8','8')
This gives me an error ValueError: not enough values to unpack (expected 2, got 1) that seems to occur at for required,completed in args[1:].
I also tried having my function take in (arg, *args) (thus avoiding any error with slicing the tuple). That also didn't work.
requiredandcompletedto have as they go through the loop?