Prolog avg z listy
average( List, Average ):-
sum( List, Sum ),
length( List, Length ),
Length > 0,
Average is Sum / Length.
Stormy Sloth
average( List, Average ):-
sum( List, Sum ),
length( List, Length ),
Length > 0,
Average is Sum / Length.