avatar Bite 64. Fix a truncating zip function

Bert is in charge of organizing an event and got the attendees names, locations and confirmations in 3 lists. Assuming he got all data and being Pythonic he used zip to stitch them together (see template code) but then he sees the output:

('Tim', 'DE', False)
('Bob', 'ES', True)
('Julian', 'AUS', True)
('Carmen', 'NL', False)
('Sofia', 'BR', True)

What?! Mike, Kim, and Andre are missing! You heard somebody mention itertools the other day for its power to work with iterators. Maybe it has a convenient way to solve this problem? Check out the module and patch the get_attendees function for Bert so it returns all names again. For missing data use dashes (-). After the fix Bert should see this output:

('Tim', 'DE', False)
('Bob', 'ES', True)
('Julian', 'AUS', True)
('Carmen', 'NL', False)
('Sofia', 'BR', True)
('Mike', 'US', '-')
('Kim', '-', '-')
('Andre', '-', '-')

Good luck, Bert will be grateful if you fix this bug for him! By the way, this won't be the last itertools Bite, it is a power tool you want to become familiar with!

Login and get coding
go back Beginner level
Bitecoin 2X

919 out of 924 users completed this Bite.
Will you be the 920th person to crack this Bite?
Resolution time: ~27 min. (avg. submissions of 5-240 min.)
Our community rates this Bite 2.61 on a 1-10 difficulty scale.
» You can do it! 😌

Focus on this Bite hiding sidebars, turn on Focus Mode.

Ask for Help