raw_data=spyware_details.split(/class="h3">/)
all_levels=raw_data[0].scan(/.\/resources\/level(\d\d?).gif/)
#all_levels is the array that consists of elements which will vary
puts all_levels.inject{ |sum, el| sum + el } / all_levels.size
Here I need the sum and average of the element list in the array? I am using Ruby 2.1.5 Version Please Help me
Aucun commentaire:
Enregistrer un commentaire