CommencerCommencer gratuitement

Getting Started with Claude Code

You're a developer who just joined a new team working on a music analytics platform. Your colleague mentioned that Claude Code can help you understand unfamiliar codebases quickly.

Your project directory contains analytics.py with this function:

def calculate_album_stats(albums, min_tracks=5, multiplier=1.2):
    """Process album data and return statistics for qualifying albums."""
    output = []
    for album in albums:
        track_count = album.get('track_count', 0)
        if track_count > min_tracks:
            adjusted_popularity = album.get('popularity', 0) * multiplier
            tier = 'platinum' if adjusted_popularity > 80 else 'gold'
            output.append({
                'album_id': album['album_id'],
                'title': album['title'],
                'original_popularity': album.get('popularity', 0),
                'adjusted_popularity': adjusted_popularity,
                'tier': tier
            })
    return sorted(output, key=lambda x: x['adjusted_popularity'], reverse=True)[:5]

Note: For instructions on how to set Claude Code up on your own machine, check the setup guide.

Cet exercice fait partie du cours

Software Development with Claude Code

Afficher le cours

Instructions

  • Start Claude Code with claude.
  • Ask Claude to explain the calculate_album_stats() function in analytics.py.
  • When done exploring, type /exit to exit Claude Code.

Exercice interactif pratique

Passez de la théorie à la pratique avec l’un de nos exercices interactifs

Commencer l’exercice