title: undefined even? method in ruby code
body: <p>I am trying to write a program which accepts 20 numbers as input from the keyboard and then I need to get the count of even,odd,positive and negative numbers from the entered numbers.I have written the following code</p>
  
  <pre><code>puts "Enter 20 numbers"
  numbers = Array.new
  while numbers.length &lt;= 20
  numbers &lt;&lt; gets.chomp
  end
  puts "You have entered 20 numbers"
  h = Hash.new
  h["even"] = numbers.select {|x| x.even? &amp;&amp; x &gt; 0}.count
  h["odd"] = numbers.select {|x| x.odd? &amp;&amp; x &gt; 0}.count
  h["positive"] = numbers.select {|x| x &gt; 0}.count
  h["negative"] = numbers.select {|x| x &lt; 0}.count
  puts h
  </code></pre>
  
  <p>However I know this is a bad code.Also it throws the following error</p>
  
  <pre><code> rytest.rb:9:in `block in &lt;main&gt;': undefined method `even?' for 
  "7":String   (NoMethodError)
   from rytest.rb:9:in `select'
   from rytest.rb:9:in `&lt;main&gt;'
  </code></pre>
  
  <p>I am not aware what I may be doing wrong as I am very new to ruby.Please help me to get a proper solution for this.</p>