This code is quite simple: First, we get the total number of published posts and the total number of approved comments. Once we have it, we just have to divide the number of comments by the number of posts.