Challenge: CSV Data Processing
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_stringto extract the age values from each row. - Compute the average of the extracted ages.
- Return the average as a float.
Ratkaisu
Kiitos palautteestasi!
single
Kysy tekoälyä
Kysy tekoälyä
Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme
Awesome!
Completion rate improved to 6.67
Challenge: CSV Data Processing
Pyyhkäise näyttääksesi valikon
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_stringto extract the age values from each row. - Compute the average of the extracted ages.
- Return the average as a float.
Ratkaisu
Kiitos palautteestasi!
single