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

bookChallenge: CSV Data Processing

Task

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

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 3. ChapterΒ 4
single

single

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

close

Awesome!

Completion rate improved to 6.67

bookChallenge: CSV Data Processing

Swipe to show menu

Task

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 desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 3. ChapterΒ 4
single

single

some-alt