In normal arithmetic, division can be performed by multiplying by the inverse. For example, the inverse of 2 is 1/2, so to divide 3 by 2 you can multiply 3 by 1/2. Note that 2 and its inverse 1/2 multiply to 1, which is always true; that's the definition of the inverse.
Modular arithmetic does not admit division, so you must multiply by the inverse. When working mod 7, the inverse of 2 is 4, because 2 * 4 = 8 = 1 (mod 7); the inverse is always that number which, when multiplied, is equal to 1, just as in normal arithmetic. So, to divide 3 by 2 (mod 7), you multiply 3 by 4 (mod 7). Now 3 * 4 = 12 = 5 (mod 7), so the result is 5, as your instructor said.
You can calculate the modular inverse of a number using the extended Euclidean algorithm. I'll leave it to you to work that out. There are lots of places where you can look up the extended Euclidean algorithm (probably including your textbook or the class notes given to you by your instructor). Or you can come back here and ask another question if you are having trouble with your code.