WordPress Code Snippet to count total posts by author

First of all you need to get all users calling get_users() function. Then you can use count_user_posts() to display post count for a user.

Try below code.

    <?php
    $blogusers = get_users();
    // Array of WP_User objects.
    foreach ( $blogusers as $user ) {
        echo 'Number of posts published by '.esc_html($user->display_name).': ' . count_user_posts( esc_html($user->id) ).'</br>';
    } 
    ?>

Update : You can easily use wp_list_authors() function also.

<?php wp_list_authors('show_fullname=1&optioncount=1&orderby=post_count&order=DESC'); ?>