In your problem you are given a base year, 2016 in this example. Since this is the base year, Nominal GDP and Real GDP will be the same there
For 2018, the prices change. This is, at least in these examples, due to inflation. In order to adjust for inflation, you ignore the "new" prices, and use the ones from the base year.
This doesn't mean anything for 2017, because prices stayed the same. But for 2018, prices went up. To solve for Real GDP, ignore this price increase and use the original 2016 prices (2016 prices * 2018 quantities)