so to figure this out:
draw all the circles out and then label each appropriately so if you are in a p orbital there are 3 suborbitals with -1, 0, and 1 designatrions. So draw out 3 circles and label each -1, 0, and 1.
Then figure out how many valence electrons you have. For example, lets say there are 5 valence electrons (an example would be chlorine) that are in the p orbital and you are looking for the quantum number of that 5th valence electron.
Put 1 electron in -1, then 0, and then 1 (this is hund's rule -- you need to fill up every suborbital with at least 1 electron before you can fill it up with 2 electrons). Note that you just used up 3 electrons. Once every orbital is filled, then add the 4th electron to -1 and then the 5th electron to 0. Congrats now you know the 5th electron is in 0)
____ ____ _____ (STEP 1 draw out suborbitals)
-1-----------0-----------1
__e1__ --> __e2__ --> _e3_ (STEP 2 fill out each orbital with 1 electron in order from least to highest)
-1-----------------0--------------1
__e1e4__ --> __e2e5__ --> __e3__ (STEP 3 add 2nd electron to each orbital lowest to highest)
-1----------------------0---------------1