typst/schule/mathe/jupyter/julia.jl
2025-02-24 17:34:16 +01:00

14 lines
277 B
Julia

function mittelwert(list::Vector{<:Tuple{<:Real, <:Real}})
upper_sum = sum(wert * anzahl for (wert, anzahl) in list)
total_count = sum(anzahl for (_, anzahl) in list)
return upper_sum/total_count
end
input = [
(1,0)
(3,0.4)
(5,6)
]
mittelwert(input)