You are viewing a single comment's thread. Return to all comments →
to_f to convert the string into float.
def serial_average(str) num1, num2, num3 = str.split("-") avg = ((num2.to_f+num3.to_f)/2).round(2) ans = "#{num1}-#{avg}" return ans end
Seems like cookies are disabled on this browser, please enable them to open this website
Ruby - Strings - Indexing
You are viewing a single comment's thread. Return to all comments →
to_f to convert the string into float.