Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

add count of vowel-started words

  • Loading branch information...
commit 063c8daa0d460f8524aacb341bb0206f0fa1be53 1 parent f1919f0
Scott Chacon authored February 18, 2011

Showing 1 changed file with 4 additions and 0 deletions. Show diff stats Hide diff stats

  1. 4  stats.rb
4  stats.rb
@@ -6,3 +6,7 @@
6 6
 avg = words.inject(0.0) { |sum, w| sum + w.size.to_f } / words.size
7 7
 puts "Average word size: " + avg.to_s
8 8
 
  9
+vowels = ['a','e','i','o','u']
  10
+vcount = words.select { |word| vowels.include?(word[0,1]) }.size
  11
+puts "Words that start with a vowel: " + vcount.to_s
  12
+

0 notes on commit 063c8da

Please sign in to comment.
Something went wrong with that request. Please try again.