You can use collection, map or each for this
data = {a: [1,2,3,4,5,6,7,8,9],b: [1,2,3,4,5,6],c: [2,3,4,5,6,7]}
data.map{|k,v| (1..9).map{|a| data[k].include?(a) ? k.to_s.upcase() +a.to_s : ' '}}
9
solved Ruby Program to print pattern [closed]
You can use collection, map or each for this
data = {a: [1,2,3,4,5,6,7,8,9],b: [1,2,3,4,5,6],c: [2,3,4,5,6,7]}
data.map{|k,v| (1..9).map{|a| data[k].include?(a) ? k.to_s.upcase() +a.to_s : ' '}}
9
solved Ruby Program to print pattern [closed]