runtime
133 / 500
question 133 Built-ins & Sorting · easy

A numbered grade report

A teacher keeps names and exam scores in two columns of the same length. Produce the numbered report lines for the class notice board. If the two columns have different lengths, a row was lost while copying, and no report should be produced at all.

Functionreport_lines(names, scores)
names, scorestwo lists, matched by position
Returnslines like "1. Ana: 72 (pass)", numbered from 1; a score of 50 or more passes, otherwise (fail)
Ruleswhen the lists have different lengths, return []
Examples
callreport_lines(['Ana', 'Ben', 'Chen'], [72, 49, 91])returns['1. Ana: 72 (pass)', '2. Ben: 49 (fail)', '3. Chen: 91 (pass)']
callreport_lines(['Dara'], [100])returns['1. Dara: 100 (pass)']
callreport_lines([], [])returns[]

Loading your progress…

A numbered grade report — Python practice · Runtime