This is a tutorial question: Use these lists in nested loops to find out which students are enrolled in both classes and count the total number of students. Your output should look like the following:
Student: Audrey is enrolled in both classes Student: Ben is enrolled in both classes Student: Julia is enrolled in both classes Student: Paul is enrolled in both classes Student: Sue is enrolled in both classes Student: Mark is enrolled in both classes 6 students are enrolled in Computer Science and Maths
I have tried count, split (was desperate) and other ways to try and get it to count how many students but having no luck. Can someone please suggest a way to get this or direct me to the correct section in the documentation?
for i in mathStudents:
both = ""
#ele = 0
for i in csStudents:
if i in mathStudents and i in csStudents:
both = i
#ele +=1
print("Student: ", both, "is enrolled in both classes \n there is", #ele.count(i)
)
break
Thanks in advance