From 46bef51f04a47d0b9a221c2e2535d7c128785343 Mon Sep 17 00:00:00 2001 From: Kate Date: Thu, 28 Feb 2019 21:53:41 -0800 Subject: [PATCH] ready to turn in --- lib/binary_to_decimal.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/binary_to_decimal.rb b/lib/binary_to_decimal.rb index 439e8c6..44abffc 100644 --- a/lib/binary_to_decimal.rb +++ b/lib/binary_to_decimal.rb @@ -6,4 +6,9 @@ # the algorithm you devised in class. def binary_to_decimal(binary_array) raise NotImplementedError + decimal = 0 + 8.times do |i| + decimal += binary_array[i] * 2 ** (7 - i) + end + return decimal end