Given:
Cody buys a bag of cookies that contains 8 chocolate chip cookies, 8 peanut butter cookies, 9 sugar cookies, and 4 oatmeal cookies.
So, the total number of cookies = 8 + 8 + 9 + 4 = 29
Cody randomly selects a sugar cookie from the bag, eats it
So, the probability to select a sugar cookie = 9/29
The number of the remaining cookies = 29 - 1 = 28
Then Cody randomly selects a peanut butter cookie.
So, the probability will be = 8/28
The overall probability will be as follows:

So, the answer will be: the probability = 18/203