Several friends wrote the party guest list together, and some names went on more than once. Write invited_twice(guests) to return the repeated names, each name only once, in the order the repeats were found. No repeats means an empty list.
invited_twice(["Ana", "Ben", "Ana", "Cal"])→['Ana']invited_twice(["Ivy", "Max", "Max", "Ivy", "Max"])→['Max', 'Ivy']invited_twice(["Lu", "Kim"])→[]def invited_twice(guests):
seen = []
repeated = []
for name in guests:
# your code here: seen before and not yet noted? note it
seen.append(name)
return repeated
Run tries the examples. When they look right, Submit.