Average array of times as strings in Ruby
问题 I have an array: array = ["0:00:31", "0:00:52", "0:01:05", "0:00:55", "0:01:33", "0:00:05", "0:00:01", "0:05:10", "0:02:40", "0:03:03", "0:01:33", "0:00:00"] and I need to average all of the times in the array that are not equal to "0:00:00" . "0:00:00" should just be thrown out. What's the best way to do this? I'm currently looping through the array, removing all of the 0:00:00 values, turning the strings into integers and doing an average - But it seems like a lot of code for what I'm