Continue writing the next sentence.

How to thank a professor
Approach them after class or during office hours.
Talk to your professor after class or meet them at office hours. Meeting in person can allow you some time to talk to the professor outside of just saying thank you if you wish.
It can also help the professor pair your name and face together. If you want to create or maintain a professional relationship with your professor, you may want to thank them in person so that they get to know you better.