Permalink
Browse files

add count of vowel-started words

  • Loading branch information...
1 parent f1919f0 commit 063c8daa0d460f8524aacb341bb0206f0fa1be53 @schacon schacon committed Feb 18, 2011
Showing with 4 additions and 0 deletions.
  1. +4 −0 stats.rb
View
@@ -6,3 +6,7 @@
avg = words.inject(0.0) { |sum, w| sum + w.size.to_f } / words.size
puts "Average word size: " + avg.to_s
+vowels = ['a','e','i','o','u']
+vcount = words.select { |word| vowels.include?(word[0,1]) }.size
+puts "Words that start with a vowel: " + vcount.to_s
+

0 comments on commit 063c8da

Please sign in to comment.