4/17
Ratios are parts/whole. That being said, you want to find the amount of apple pies (part) to total pies (whole).
Looking at the question, there are 8 apple pies.
8/x
Add up the total amount of pies. 6+7+13+8 = 34
8/34
8/34 can be simplified. (divide both by 2)
4/17