In a school database, do I need to have repeating data when a student can also be a teacher?
What you are saying makes sense, yes.

One thing is that you actually can't select students without excluding Persons that are teachers...  And even if you did, the students that are also teachers would be missing without further efforts. So maybe it makes sense to have a students table as well to assign Persons that are students the same way you did it with teachers.

Meaning:
P1 is a teacher. 
P2 is a Student. 
...

There are for sure more possible solutions. I think it all depends on the requirement you have and any solution must stand.

It's possible that a student also sometimes is a teacher and maybe even teaches the course where he or she is a Student... Or Maybe the school Administration used a database for different school let's say elementary same time as for parents night school. Maybe then additional flexibility is required.

Basically just go ahead and think about normalization to solve your requirement and get to a valuable Model. Using m:n tables to solve this just follows the normalization rules.

Normalization howto example:

https://www.studytonight.com/dbms/database-normalization.php