Oct-18-2021, 08:08 PM
Indeed, the instructions suggest one loop with exclusion of the bad names as soon as they are entered. But, your example desired output suggests that all names are added and then a second loop goes through that list and does the exclusions.
So which is it?
If the latter, I would build a second list of names from the first, adding a name only if it is not in the bad name list.
So which is it?
If the latter, I would build a second list of names from the first, adding a name only if it is not in the bad name list.
good_list = [] for name in users: if name not in banned_users: good_list.append(name)