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.
Løsning
Takk for tilbakemeldingene dine!
single
Spør AI
Spør AI
Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår
Awesome!
Completion rate improved to 6.67
Challenge: CSV Data Processing
Sveip for å vise menyen
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.
Løsning
Takk for tilbakemeldingene dine!
single