From aa04ab96fa63c1af834472e6d37865d6eea95310 Mon Sep 17 00:00:00 2001 From: JohannaUha Date: Tue, 17 Jan 2017 19:46:43 +0200 Subject: [PATCH] teht9 --- koodi.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/koodi.rb b/koodi.rb index 932f2b3..d4d2a76 100644 --- a/koodi.rb +++ b/koodi.rb @@ -1 +1,7 @@ -# kirjoita koodi tänne +def esiintymat(taulu) + counts = Hash.new 0 + taulu.each do |alkio| + counts[alkio]+=1 + end + counts +end