average function
Sonlar ro'yxatining o‘rtacha qiymatini hisoblash
Implementation
double average(List<int> numbers) {
if (numbers.isEmpty) {
throw ArgumentError('Bo\'sh ro\'yxat uchun o\'rtacha hisoblab bo\'lmaydi');
}
return numbers.reduce((a, b) => a + b) / numbers.length;
}