Your question is very terse, but insofar as you can assign a shortcut key to an action or script, and an action can do just about anything you can do, then the short answer is yes.
If you do choose to create an action to help you manage layer opacity, you'll have to make some assumptions about the document you're working on, and the conditions in which you're working. An action can't really make decisions - for example it can't take one of two paths of execution based on whether the layer is an adjustment layer or an image layer. A script, by contrast, can do conditional execution.
With something as simple as current layer opacity, an action should be able to affect a variety of different kinds of layers, so assuming you want a shortcut key to set the current layer to a fixed level of opacity - e.g., 50% - I'd try the action approach first.
Hope this helps.
If you want to use an existing keyboard shortcut,
then using the number keys changes the layer opacity
except when you have any paint tool selected that has opacity for the
brush and then the number keys change the brush opacity.
The 0 (zero) key = 100% opacity and the 1 key equals 10% opacity.
If you want an opacity of say 5%, then hitting the 0 then 5 in quick
succession would give you 5% opacity.