Sure, here's an example Python function that takes two lists of student names as arguments and returns a list of students who are taking both classes:
def getResult(classOne, classTwo):
# use set intersection to find students who are in both classes
studentsTakingBoth = list(set(classOne) & set(classTwo))
return studentsTakingBoth
Here's an example usage of the function:
classOne = ['Alice', 'Bob', 'Charlie', 'David']
classTwo = ['Bob', 'David', 'Eve', 'Frank']
studentsTakingBoth = getResult(classOne, classTwo)
print(studentsTakingBoth) # should print ['Bob', 'David']
In this example, the getResult function takes two lists classOne and classTwo as arguments, and finds the intersection of the two sets of students using the set intersection operator &. The resulting list is then returned. Note that we first convert the set intersection result into a list before returning it, since the set data type does not preserve the order of elements.