← Back to challenges

Get Students with Names and Notes Average

PythonHardarraysobjects

Instructions

Create a function that takes a list of dictionary like { name: "John", notes: [3, 5, 4]} and returns a list of dictionary like { name: "John", avgNote: 4 }. If student has no notes (an empty array) then avgNote is zero.

Examples

[
  { name: "John", notes: [3, 5, 4]}
] ➞ [
  { name: "John", avgNote: 4 }
]

Notes

Round the avgNote to a whole number.

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.