class DNA def initialize( str ) @strand = str.chars end def hamming_distance( str ) other_strand = str.chars distance = 0 @strand.each_with_index do | letter, i | if other_strand[i] distance += 1 if letter != other_strand[i] end end distance end end