0% found this document useful (0 votes)
18 views1 page

Def Intersection 47

Uploaded by

rewajoshi05
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views1 page

Def Intersection 47

Uploaded by

rewajoshi05
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

def intersection(lst1,lst2):

# function to find intersection of two lists


intersect = []
for student in lst1:
if student in lst2:
intersect.append(student)
return intersect

count = total_students
for student in lst1:
if student in lst2 or student in lst3:
count -= 1
return count

def main():
cricket_players = ["A","B","C","D","E"]
badminton_players = ["C","D","F","G","H"]
football_players = ["B","D","E","F","G"]

both_cricket_badminton = intersection(cricket_players, badminton_players)


print("Students who play both cricket and badminton:",
both_cricket_badminton)

You might also like