Zip Three Parallel Lists into Tuple Records

Easy ⏱ 8 min 80% acceptance ★★★★☆ 4.4
Implement build_records(ids, names, scores) that uses zip() to combine three parallel lists into a list of 3-tuples (id, name, score) — returning the tuples themselves (not formatted strings), stopping at the shortest input list.

Examples

Example 1
Input
build_records([1, 2], ['A', 'B'], [90, 85])
Output
[(1, 'A', 90), (2, 'B', 85)]
Explanation

zip() pairs elements positionally into tuples.

Example 2
Input
build_records([1, 2, 3], ['A'], [90, 85])
Output
[(1, 'A', 90)]
Explanation

zip() stops at the shortest list.

Constraints

  • ids, names, scores are lists (possibly of differing lengths).

Topics

Tupleszip()

Companies

AppleAccenture

Hints

Hint 1

list(zip(ids, names, scores)) directly produces a list of 3-tuples.

Loading the Python runtime… Run executes your code and shows printed output; Submit checks your function against this problem's examples.