Answer
Please see the work below.
Work Step by Step
Some elements and compounds can act both as reducing or oxidizing agents. The hydrogen molecule is a reducing agent when it reacts with non-metals and an oxidizing agent when it reacts with metals.
$2 Li_{(s)} + H_{2(g)} → 2 LiH_{(s)}$
Hydrogen acts as an oxidizing agent because it accepts an electron from lithium, which causes Li to be oxidized.
$H_{2(g)} + F_{2(g)} → 2 HF_{(g)} $
Hydrogen acts as a reducing agent because it donates its electrons to fluorine; as a result, fluorine gets reduced.