Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Apprendre Challenge: CSV Data Processing | Working with Structured Data Formats
Working with Strings and Data Formats

bookChallenge: CSV Data Processing

Tâche

Swipe to start coding

Write a function that takes a CSV-formatted string containing names and ages, and returns the average age as a float. The CSV string will have a header row with the columns "name" and "age", followed by rows of data. The function should extract the ages, calculate the average, and return the result as a float.

  • Parse the csv_string to extract the age values from each row.
  • Compute the average of the extracted ages.
  • Return the average as a float.

Solution

Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 3. Chapitre 4
single

single

Demandez à l'IA

expand

Demandez à l'IA

ChatGPT

Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion

close

Awesome!

Completion rate improved to 6.67

bookChallenge: CSV Data Processing

Glissez pour afficher le menu

Tâche

Swipe to start coding

Write a function that takes a CSV-formatted string containing names and ages, and returns the average age as a float. The CSV string will have a header row with the columns "name" and "age", followed by rows of data. The function should extract the ages, calculate the average, and return the result as a float.

  • Parse the csv_string to extract the age values from each row.
  • Compute the average of the extracted ages.
  • Return the average as a float.

Solution

Switch to desktopPassez à un bureau pour une pratique réelleContinuez d'où vous êtes en utilisant l'une des options ci-dessous
Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 3. Chapitre 4
single

single

some-alt