In the wild
The life expectancy of a giant panda can vary quite a lot depending on different factors, such as availability of food, state of the local habitat and numerous others.
On average a giant panda living in the wild will live for between 15 - 20 years.
A giant panda living in captivity lives on average for 25 - 35 years, with the record age being 38 years old.
It takes around 5 years for a panda to be fully grown, so ages 1 - 5 are considered their teenage years. From age 5 to roughly age 18, they are in their prime and we would consider old age for a giant panda to be 18 - 20 years plus.
Giant pandas typically survive longer in captivity because they are protected from the various environmental threats they would face in their natural habitat. Although the work of conservationists is vital to maintain and replenish the giant panda population, the eventual aim is to return as many giant pandas to the wild as possible.
There’s a full list of all the giant pandas (and their ages) in captivity over at Giant Panda Zoo that is really worth checking out, you can find it here.