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.
Рішення
Дякуємо за ваш відгук!
single
Запитати АІ
Запитати АІ
Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат
Awesome!
Completion rate improved to 6.67
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.
Рішення
Дякуємо за ваш відгук!
single