12. All students in a class took tests in three events: sprinting, swimming, and basketball. 4 students did not excel in any of these three events, while the rest each excelled in at least one event. The number of students who excelled in each event is shown in the table below:
\begin{tabular}{|c|c|c|c|c|c|c|}
\hline Sprinting & Swimming & Basketball & Sprinting, Swimming & Swimming, Basketball & Basketball, Sprinting & Sprinting, Swimming, Basketball \\
\hline 17 & 18 & 15 & 6 & 6 \\
\hline
\end{tabular}

Find the number of students in this class.
12.【Solution】In $4+17+18+15$, two items that reached excellence were counted twice, so one count should be removed from the statistics, making it $4+17+18+15-6-6-5$.

However, the students who excelled in three items were initially counted three times and then removed three times, so this part of the number of students should be added back, i.e., the total number of students in the class is: $4+17+18+15-6-6-5+2=39$

【Another Solution】First, find the number of students who excelled in at least one project. See the diagram below: The three circles represent the number of students who excelled in short running, swimming, and basketball, respectively. In the diagram:
“1” represents the number of students who excelled in all three projects, which is: 2;
“2” represents the number of students who excelled in basketball and swimming but not in short running, which is: 6 $-2=4$;
“3” represents the number of students who excelled in basketball and short running but not in swimming, which is: 5 $-2=3$;
“4” represents the number of students who excelled in swimming and short running but not in basketball, which is: $6-2=4$;
“5” represents the number of students who excelled only in short running, which is: $17-(2+3+4)=8$;
“6” represents the number of students who excelled only in swimming, which is: $18-(2+4+4)=8$;
“7” represents the number of students who excelled only in basketball, which is: $15-(2+4+3)=6$;
$\therefore$ The number of students who excelled in only one project is: $2+4+3+4+8+8+6=35$
There are 4 students who did not excel in any of the three projects, so the total number of students in the class is $35+4=39$.

Answer: The class has 39 students.