In[154]:= exp = Table[Power[RandomChoice[{x, y, z}], i], {i, -3, 3}]
Out[154]= {1/y^3, 1/y^2, 1/y, 1, x, y^2, y^3}
Define a function that checks the form of the input expression and returns the exponent (power).
pwrChk[expr_] := Switch[expr,
(*1. Address the case of the constant*)
(*-----> If input is*)1, (*then return*)0,
(*2. Address all regular powers of the form x^y. *)
(*----->If input is*)Power[x_, y_], (*then return*) FullForm[expr][[1, 2]],
(*3. Address cases like x^1.*)
(*----->If input is*)expr, (*return*)1]
Try it on our sample list of expressions.
In[157]:= pwrChk[#] & /@ exp
Out[157]= {-3, -2, -1, 0, 1, 2, 3}
The answer is a list with the powers of the input expressions including cases where the power was a zero or one.